From cb6b43f0b669152b9dc3824007c6ad4018dc3d85 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 7 May 2016 17:03:19 -0700 Subject: [PATCH] check for indextx. --- lib/bcoin/chaindb.js | 9 +++++++++ lib/bcoin/mempool.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index e45212e1..6c98bf34 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -1249,6 +1249,9 @@ ChainDB.prototype.getTX = function getTX(hash, callback) { var key = 't/' + hash; var tx; + if (!this.options.indexTX) + return utils.nextTick(callback); + this.db.get(key, function(err, data) { if (err && err.type !== 'NotFoundError') return callback(err); @@ -1275,6 +1278,9 @@ ChainDB.prototype.getTX = function getTX(hash, callback) { */ ChainDB.prototype.hasTX = function hasTX(hash, callback) { + if (!this.options.indexTX) + return utils.asyncify(callback)(null, false); + return this.getTX(hash, function(err, tx) { if (err) return callback(err); @@ -1292,6 +1298,9 @@ ChainDB.prototype.hasTX = function hasTX(hash, callback) { ChainDB.prototype.getFullTX = function getFullTX(hash, callback) { var self = this; + if (!this.options.indexTX) + return utils.nextTick(callback); + return this.getTX(hash, function(err, tx) { if (err) return callback(err); diff --git a/lib/bcoin/mempool.js b/lib/bcoin/mempool.js index ac5f6138..134e83cf 100644 --- a/lib/bcoin/mempool.js +++ b/lib/bcoin/mempool.js @@ -1216,7 +1216,7 @@ Mempool.prototype.fillAllHistory = function fillAllHistory(tx, callback) { if (tx.hasCoins()) return callback(null, tx); - self.chain.db.fillHistory(tx, callback); + self.chain.db.fillCoins(tx, callback); }); };