From 01409b34af87a8972ac376d643ac9c10d79ac689 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 18 May 2014 03:58:07 -0500 Subject: [PATCH] pool: emit `blocks` and `txs` event on pool. Signed-off-by: Fedor Indutny --- lib/bcoin/peer.js | 1 + lib/bcoin/pool.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index 7ea94ed7..2472920a 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -351,6 +351,7 @@ Peer.prototype._handleInv = function handleInv(items) { if (txs.length === 0) return; + this.emit('txs', txs); this.getData(txs); }; diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index f9dcd202..8e8620b0 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -314,6 +314,14 @@ Pool.prototype._addPeer = function _addPeer(backoff) { peer.on('addr', function(addr) { self.emit('addr', addr); }); + + peer.on('blocks', function(blocks) { + self.emit('blocks', blocks); + }); + + peer.on('txs', function(txs) { + self.emit('txs', txs); + }); }; Pool.prototype._removePeer = function _removePeer(peer) {