iterate options.

This commit is contained in:
Christopher Jeffrey 2016-07-06 12:05:41 -07:00
parent 40217ebebe
commit 5115b43435
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 12 additions and 26 deletions

View File

@ -265,27 +265,17 @@ LowlevelUp.prototype.iterate = function iterate(options, callback) {
gte: options.gte,
lte: options.lte,
keys: true,
values: options.values,
fillCache: false,
values: options.values || false,
fillCache: options.fillCache || false,
keyAsBuffer: options.keyAsBuffer || false,
limit: options.limit,
reverse: options.reverse
reverse: options.reverse || false
};
if (opt.gte == null)
delete opt.gte;
if (opt.lte == null)
delete opt.lte;
if (opt.values == null)
delete opt.values;
if (opt.limit == null)
delete opt.limit;
if (opt.reverse == null)
delete opt.reverse;
// Work around a bug in leveldown that
// I haven't fixed yet, where iterator
// treats limit=undefined as limit=0.
if (options.limit != null)
opt.limit = options.limit;
iter = this.iterator(opt);

View File

@ -215,7 +215,7 @@ WalletDB.prototype.updateBalances = function updateBalances(tx, map, callback) {
self.fire(id, 'balance', balances[id]);
}
self.emit('balances', balances, map);
self.emit('balance', balances, map);
return callback(null, balances);
});
@ -758,19 +758,15 @@ WalletDB.prototype.saveAddress = function saveAddress(id, addresses, callback) {
for (i = 0; i < addresses.length; i++) {
address = addresses[i];
path = Path.fromKeyRing(address);
items.push([address.getKeyAddress(), path]);
if (address.type === 'multisig') {
path = Path.fromKeyRing(address);
if (address.type === 'multisig')
items.push([address.getScriptAddress(), path]);
}
if (address.witness) {
path = Path.fromKeyRing(address);
if (address.witness)
items.push([address.getProgramAddress(), path]);
}
}
utils.forEachSerial(items, function(item, next) {