mempool: fix mempool.has().

This commit is contained in:
Christopher Jeffrey 2016-09-24 02:34:00 -07:00
parent 099fe186f0
commit 5a6099e992
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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',