pool: fix bad orphan event handling.

This commit is contained in:
Christopher Jeffrey 2017-07-17 22:39:11 -07:00
parent 2fb16a6c97
commit 98c975de8b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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);
});
}
};