mempool: fix mempool.has().
This commit is contained in:
parent
099fe186f0
commit
5a6099e992
@ -517,11 +517,23 @@ Mempool.prototype.has = function has(hash) {
|
||||
if (this.locker.hasPending(hash))
|
||||
return true;
|
||||
|
||||
if (this.hasOrphan(hash))
|
||||
if (hash === this.currentTX)
|
||||
return true;
|
||||
|
||||
//if (hash === this.currentTX)
|
||||
//return true;
|
||||
return this.exists(hash);
|
||||
};
|
||||
|
||||
/**
|
||||
* Test the mempool to see if it
|
||||
* contains a transaction or an orphan.
|
||||
* @private
|
||||
* @param {Hash} hash
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
Mempool.prototype.exists = function exists(hash) {
|
||||
if (this.hasOrphan(hash))
|
||||
return true;
|
||||
|
||||
return this.hasTX(hash);
|
||||
};
|
||||
@ -639,7 +651,7 @@ Mempool.prototype._addTX = co(function* _addTX(tx) {
|
||||
0);
|
||||
}
|
||||
|
||||
if (this.has(hash)) {
|
||||
if (this.exists(hash)) {
|
||||
throw new VerifyError(tx,
|
||||
'alreadyknown',
|
||||
'txn-already-in-mempool',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user