check for indextx.

This commit is contained in:
Christopher Jeffrey 2016-05-07 17:03:19 -07:00
parent db1f34c00d
commit cb6b43f0b6
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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);
});
};