From 33260786947756b434735f635aa1c40237e49544 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 6 May 2016 14:03:50 -0700 Subject: [PATCH] check mempool before requesting tx. --- lib/bcoin/pool.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 3547110a..d390cd59 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -1612,8 +1612,14 @@ Pool.prototype.getData = function getData(peer, type, hash, options, callback) { return callback(); } - if (!options.force && type !== self.tx.type) - return self.chain.has(hash, done); + if (!options.force) { + if (type === this.tx.type) { + if (!this.mempool) + return utils.asyncify(done)(null, false); + return this.mempool.hasTX(hash, done); + } + return this.chain.has(hash, done); + } return utils.nextTick(function() { return done(null, false);