iterate options.
This commit is contained in:
parent
40217ebebe
commit
5115b43435
@ -265,27 +265,17 @@ LowlevelUp.prototype.iterate = function iterate(options, callback) {
|
|||||||
gte: options.gte,
|
gte: options.gte,
|
||||||
lte: options.lte,
|
lte: options.lte,
|
||||||
keys: true,
|
keys: true,
|
||||||
values: options.values,
|
values: options.values || false,
|
||||||
fillCache: false,
|
fillCache: options.fillCache || false,
|
||||||
keyAsBuffer: options.keyAsBuffer || false,
|
keyAsBuffer: options.keyAsBuffer || false,
|
||||||
limit: options.limit,
|
reverse: options.reverse || false
|
||||||
reverse: options.reverse
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (opt.gte == null)
|
// Work around a bug in leveldown that
|
||||||
delete opt.gte;
|
// I haven't fixed yet, where iterator
|
||||||
|
// treats limit=undefined as limit=0.
|
||||||
if (opt.lte == null)
|
if (options.limit != null)
|
||||||
delete opt.lte;
|
opt.limit = options.limit;
|
||||||
|
|
||||||
if (opt.values == null)
|
|
||||||
delete opt.values;
|
|
||||||
|
|
||||||
if (opt.limit == null)
|
|
||||||
delete opt.limit;
|
|
||||||
|
|
||||||
if (opt.reverse == null)
|
|
||||||
delete opt.reverse;
|
|
||||||
|
|
||||||
iter = this.iterator(opt);
|
iter = this.iterator(opt);
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,7 @@ WalletDB.prototype.updateBalances = function updateBalances(tx, map, callback) {
|
|||||||
self.fire(id, 'balance', balances[id]);
|
self.fire(id, 'balance', balances[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.emit('balances', balances, map);
|
self.emit('balance', balances, map);
|
||||||
|
|
||||||
return callback(null, balances);
|
return callback(null, balances);
|
||||||
});
|
});
|
||||||
@ -758,19 +758,15 @@ WalletDB.prototype.saveAddress = function saveAddress(id, addresses, callback) {
|
|||||||
|
|
||||||
for (i = 0; i < addresses.length; i++) {
|
for (i = 0; i < addresses.length; i++) {
|
||||||
address = addresses[i];
|
address = addresses[i];
|
||||||
|
|
||||||
path = Path.fromKeyRing(address);
|
path = Path.fromKeyRing(address);
|
||||||
|
|
||||||
items.push([address.getKeyAddress(), path]);
|
items.push([address.getKeyAddress(), path]);
|
||||||
|
|
||||||
if (address.type === 'multisig') {
|
if (address.type === 'multisig')
|
||||||
path = Path.fromKeyRing(address);
|
|
||||||
items.push([address.getScriptAddress(), path]);
|
items.push([address.getScriptAddress(), path]);
|
||||||
}
|
|
||||||
|
|
||||||
if (address.witness) {
|
if (address.witness)
|
||||||
path = Path.fromKeyRing(address);
|
|
||||||
items.push([address.getProgramAddress(), path]);
|
items.push([address.getProgramAddress(), path]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.forEachSerial(items, function(item, next) {
|
utils.forEachSerial(items, function(item, next) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user