diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index 674022a5..89f581e8 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -277,7 +277,7 @@ Mempool.prototype._removeBlock = co(function* removeBlock(block, txs) { tx = txs[i]; hash = tx.hash('hex'); - if (this.hasTX(hash)) + if (this.hasEntry(hash)) continue; try { @@ -410,7 +410,7 @@ Mempool.prototype.limitSize = function limitSize(added) { entry = queue.shift(); hash = entry.hash('hex'); - if (!this.hasTX(hash)) + if (!this.hasEntry(hash)) continue; this.evictEntry(entry); @@ -646,7 +646,7 @@ Mempool.prototype.getMeta = function getMeta(hash) { * @returns {Boolean} */ -Mempool.prototype.hasTX = function hasTX(hash) { +Mempool.prototype.hasEntry = function hasEntry(hash) { return this.map[hash] != null; }; @@ -664,7 +664,7 @@ Mempool.prototype.has = function has(hash) { if (this.hasOrphan(hash)) return true; - return this.hasTX(hash); + return this.hasEntry(hash); }; /** @@ -682,7 +682,7 @@ Mempool.prototype.exists = function exists(hash) { if (this.hasOrphan(hash)) return true; - return this.hasTX(hash); + return this.hasEntry(hash); }; /** @@ -1381,7 +1381,7 @@ Mempool.prototype.getDepends = function getDepends(tx) { for (i = 0; i < prevout.length; i++) { hash = prevout[i]; - if (this.hasTX(hash)) + if (this.hasEntry(hash)) depends.push(hash); } diff --git a/lib/mining/miner.js b/lib/mining/miner.js index 3f411fed..2d2ba162 100644 --- a/lib/mining/miner.js +++ b/lib/mining/miner.js @@ -412,7 +412,7 @@ Miner.prototype.build = function build(attempt) { input = tx.inputs[j]; prev = input.prevout.hash; - if (!this.mempool.hasTX(prev)) + if (!this.mempool.hasEntry(prev)) continue; item.depCount += 1; diff --git a/lib/node/fullnode.js b/lib/node/fullnode.js index d85b8c6f..6f19b836 100644 --- a/lib/node/fullnode.js +++ b/lib/node/fullnode.js @@ -516,12 +516,12 @@ FullNode.prototype.getTX = co(function* getTX(hash) { * @returns {Promise} - Returns Boolean. */ -FullNode.prototype.hasTX = function hasTX(hash) { - if (this.mempool.hasTX(hash)) - return Promise.resolve(true); +FullNode.prototype.hasTX = co(function* hasTX(hash) { + if (this.mempool.hasEntry(hash)) + return true; - return this.chain.db.hasTX(hash); -}; + return yield this.chain.db.hasTX(hash); +}); /* * Expose