chaindb: check options.
This commit is contained in:
parent
b0aebb9c84
commit
0208f9383c
@ -1229,6 +1229,9 @@ ChainDB.prototype.fillCoins = function fillCoins(tx, callback) {
|
||||
ChainDB.prototype.fillHistory = function fillHistory(tx, callback) {
|
||||
var self = this;
|
||||
|
||||
if (!this.options.indexTX)
|
||||
return utils.asyncify(callback)(null, tx);
|
||||
|
||||
if (tx.isCoinbase())
|
||||
return utils.asyncify(callback)(null, tx);
|
||||
|
||||
@ -1427,6 +1430,9 @@ ChainDB.prototype.getCoinsByAddress = function getCoinsByAddress(addresses, call
|
||||
var self = this;
|
||||
var coins = [];
|
||||
|
||||
if (!this.options.indexAddress)
|
||||
return utils.asyncify(callback)(null, coins);
|
||||
|
||||
if (!Array.isArray(addresses))
|
||||
addresses = [addresses];
|
||||
|
||||
@ -1491,6 +1497,9 @@ ChainDB.prototype.getHashesByAddress = function getHashesByAddress(addresses, ca
|
||||
var self = this;
|
||||
var hashes = {};
|
||||
|
||||
if (!this.options.indexTX || !this.options.indexAddress)
|
||||
return utils.asyncify(callback)(null, []);
|
||||
|
||||
utils.forEachSerial(addresses, function(address, next) {
|
||||
var hash = bcoin.address.getHash(address);
|
||||
|
||||
@ -1522,6 +1531,9 @@ ChainDB.prototype.getTXByAddress = function getTXByAddress(addresses, callback)
|
||||
var self = this;
|
||||
var txs = [];
|
||||
|
||||
if (!this.options.indexTX || !this.options.indexAddress)
|
||||
return utils.asyncify(callback)(null, txs);
|
||||
|
||||
if (!Array.isArray(addresses))
|
||||
addresses = [addresses];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user