add orphan events to mempool.
This commit is contained in:
parent
ed08f36e07
commit
7cf1f8802f
@ -804,6 +804,7 @@ Mempool.prototype.addUnchecked = function addUnchecked(entry, callback, force) {
|
||||
bcoin.debug('Could not resolve orphan %s: %s.',
|
||||
tx.rhash,
|
||||
err.message);
|
||||
self.emit('bad orphan', tx, entry);
|
||||
return next();
|
||||
}
|
||||
self.emit('error', err);
|
||||
@ -1102,6 +1103,7 @@ Mempool.prototype.storeOrphan = function storeOrphan(tx) {
|
||||
|
||||
if (tx.getSize() > 5000) {
|
||||
bcoin.debug('Ignoring large orphan: %s', tx.rhash);
|
||||
this.emit('bad orphan', tx);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1129,6 +1131,8 @@ Mempool.prototype.storeOrphan = function storeOrphan(tx) {
|
||||
|
||||
bcoin.debug('Added orphan %s to mempool.', tx.rhash);
|
||||
|
||||
this.emit('add orphan', tx);
|
||||
|
||||
this.limitOrphans();
|
||||
};
|
||||
|
||||
@ -1294,6 +1298,8 @@ Mempool.prototype.removeOrphan = function removeOrphan(tx) {
|
||||
|
||||
delete this.orphans[hash];
|
||||
|
||||
this.emit('remove orphan', tx);
|
||||
|
||||
this.totalOrphans--;
|
||||
};
|
||||
|
||||
|
||||
@ -270,6 +270,15 @@ Pool.prototype._init = function _init() {
|
||||
var self = this;
|
||||
var i;
|
||||
|
||||
if (this.mempool) {
|
||||
this.mempool.on('add orphan', function(tx) {
|
||||
self.rejects.add(tx.hash());
|
||||
});
|
||||
this.mempool.on('bad orphan', function(tx) {
|
||||
self.rejects.add(tx.hash());
|
||||
});
|
||||
}
|
||||
|
||||
this.chain.on('block', function(block, entry, peer) {
|
||||
// Emit merkle txs after the fact
|
||||
if (self.options.spv) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user