check for indextx.
This commit is contained in:
parent
db1f34c00d
commit
cb6b43f0b6
@ -1249,6 +1249,9 @@ ChainDB.prototype.getTX = function getTX(hash, callback) {
|
|||||||
var key = 't/' + hash;
|
var key = 't/' + hash;
|
||||||
var tx;
|
var tx;
|
||||||
|
|
||||||
|
if (!this.options.indexTX)
|
||||||
|
return utils.nextTick(callback);
|
||||||
|
|
||||||
this.db.get(key, function(err, data) {
|
this.db.get(key, function(err, data) {
|
||||||
if (err && err.type !== 'NotFoundError')
|
if (err && err.type !== 'NotFoundError')
|
||||||
return callback(err);
|
return callback(err);
|
||||||
@ -1275,6 +1278,9 @@ ChainDB.prototype.getTX = function getTX(hash, callback) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ChainDB.prototype.hasTX = function hasTX(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) {
|
return this.getTX(hash, function(err, tx) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
@ -1292,6 +1298,9 @@ ChainDB.prototype.hasTX = function hasTX(hash, callback) {
|
|||||||
ChainDB.prototype.getFullTX = function getFullTX(hash, callback) {
|
ChainDB.prototype.getFullTX = function getFullTX(hash, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
if (!this.options.indexTX)
|
||||||
|
return utils.nextTick(callback);
|
||||||
|
|
||||||
return this.getTX(hash, function(err, tx) {
|
return this.getTX(hash, function(err, tx) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|||||||
@ -1216,7 +1216,7 @@ Mempool.prototype.fillAllHistory = function fillAllHistory(tx, callback) {
|
|||||||
if (tx.hasCoins())
|
if (tx.hasCoins())
|
||||||
return callback(null, tx);
|
return callback(null, tx);
|
||||||
|
|
||||||
self.chain.db.fillHistory(tx, callback);
|
self.chain.db.fillCoins(tx, callback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user