diff --git a/lib/net/pool.js b/lib/net/pool.js index 67ebffe7..185281c1 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -178,10 +178,18 @@ Pool.prototype._init = function _init() { this.logger.info('Chain is fully synced (height=%d).', this.chain.height); }); + this.chain.on('bad orphan', (err, id) => { + this.handleBadOrphan('block', err, id); + }); + if (this.mempool) { this.mempool.on('tx', (tx) => { this.emit('tx', tx); }); + + this.mempool.on('bad orphan', (err, id) => { + this.handleBadOrphan('tx', err, id); + }); } if (!this.options.selfish && !this.options.spv) { @@ -189,10 +197,6 @@ Pool.prototype._init = function _init() { this.mempool.on('tx', (tx) => { this.announceTX(tx); }); - - this.mempool.on('bad orphan', (err, id) => { - this.handleBadOrphan('tx', err, id); - }); } // Normally we would also broadcast @@ -206,10 +210,6 @@ Pool.prototype._init = function _init() { return; this.announceBlock(block); }); - - this.chain.on('bad orphan', (err, id) => { - this.handleBadOrphan('block', err, id); - }); } };