minor fixes.

This commit is contained in:
Christopher Jeffrey 2016-03-04 04:27:03 -08:00
parent f67902a9cf
commit 14a51a25b2

View File

@ -304,19 +304,19 @@ TXPool.prototype._add = function add(tx, map, callback, force) {
assert(existing.ps > 0); assert(existing.ps > 0);
batch.put(prefix + 't/t/' + hash, tx.toExtended()); batch.put(prefix + 't/t/' + hash, tx.toExtended());
batch.del(prefix + 't/p/t/' + hash);
batch.put(prefix + 't/h/h/' + pad32(tx.height) + '/' + hash, DUMMY); batch.put(prefix + 't/h/h/' + pad32(tx.height) + '/' + hash, DUMMY);
batch.del(prefix + 't/s/s/' + pad32(existing.ps) + '/' + hash); batch.del(prefix + 't/s/s/' + pad32(existing.ps) + '/' + hash);
batch.put(prefix + 't/s/s/' + pad32(tx.ts) + '/' + hash, DUMMY); batch.put(prefix + 't/s/s/' + pad32(tx.ts) + '/' + hash, DUMMY);
batch.del(prefix + 't/p/t/' + hash);
map.all.forEach(function(id) { map.all.forEach(function(id) {
batch.del(prefix + 't/p/a/' + id + '/' + hash);
batch.put( batch.put(
prefix + 't/h/a/' + id + '/' + pad32(tx.height) + '/' + hash, DUMMY); prefix + 't/h/a/' + id + '/' + pad32(tx.height) + '/' + hash, DUMMY);
batch.del( batch.del(
prefix + 't/s/a/' + id + '/' + pad32(existing.ps) + '/' + hash); prefix + 't/s/a/' + id + '/' + pad32(existing.ps) + '/' + hash);
batch.put( batch.put(
prefix + 't/s/a/' + id + '/' + pad32(tx.ts) + '/' + hash, DUMMY); prefix + 't/s/a/' + id + '/' + pad32(tx.ts) + '/' + hash, DUMMY);
batch.del(prefix + 't/p/a/' + id + '/' + hash);
}); });
utils.forEachSerial(tx.outputs, function(output, next, i) { utils.forEachSerial(tx.outputs, function(output, next, i) {
@ -744,10 +744,10 @@ TXPool.prototype._unconfirm = function unconfirm(tx, map, callback) {
batch.put(prefix + 't/s/s/' + pad32(tx.ps) + '/' + hash, DUMMY); batch.put(prefix + 't/s/s/' + pad32(tx.ps) + '/' + hash, DUMMY);
map.all.forEach(function(id) { map.all.forEach(function(id) {
batch.put(prefix + 't/p/a/' + id + '/' + hash, DUMMY);
batch.del(prefix + 't/h/a/' + id + '/' + pad32(height) + '/' + hash); batch.del(prefix + 't/h/a/' + id + '/' + pad32(height) + '/' + hash);
batch.del(prefix + 't/s/a/' + id + '/' + pad32(ts) + '/' + hash); batch.del(prefix + 't/s/a/' + id + '/' + pad32(ts) + '/' + hash);
batch.put(prefix + 't/s/a/' + id + '/' + pad32(tx.ps) + '/' + hash, DUMMY); batch.put(prefix + 't/s/a/' + id + '/' + pad32(tx.ps) + '/' + hash, DUMMY);
batch.put(prefix + 't/p/a/' + id + '/' + hash, DUMMY);
}); });
utils.forEachSerial(tx.outputs, function(output, next, i) { utils.forEachSerial(tx.outputs, function(output, next, i) {
@ -973,7 +973,6 @@ TXPool.prototype.getHeightRangeHashes = function getHeightRangeHashes(address, o
var prefix = this.prefix + '/'; var prefix = this.prefix + '/';
var self = this; var self = this;
var txs = []; var txs = [];
var total = 0;
var iter; var iter;
callback = utils.ensure(callback); callback = utils.ensure(callback);
@ -989,6 +988,7 @@ TXPool.prototype.getHeightRangeHashes = function getHeightRangeHashes(address, o
values: false, values: false,
fillCache: false, fillCache: false,
keyAsBuffer: false, keyAsBuffer: false,
limit: options.limit,
reverse: options.reverse reverse: options.reverse
}); });
@ -1010,9 +1010,6 @@ TXPool.prototype.getHeightRangeHashes = function getHeightRangeHashes(address, o
txs.push(key.split('/')[4]); txs.push(key.split('/')[4]);
if (++total === options.limit)
return callback(null, txs);
next(); next();
}); });
})(); })();
@ -1026,7 +1023,6 @@ TXPool.prototype.getTimeRangeHashes = function getTimeRangeHashes(address, optio
var prefix = this.prefix + '/'; var prefix = this.prefix + '/';
var self = this; var self = this;
var txs = []; var txs = [];
var total = 0;
var iter; var iter;
callback = utils.ensure(callback); callback = utils.ensure(callback);
@ -1042,6 +1038,7 @@ TXPool.prototype.getTimeRangeHashes = function getTimeRangeHashes(address, optio
values: false, values: false,
fillCache: false, fillCache: false,
keyAsBuffer: false, keyAsBuffer: false,
limit: options.limit,
reverse: options.reverse reverse: options.reverse
}); });
@ -1063,9 +1060,6 @@ TXPool.prototype.getTimeRangeHashes = function getTimeRangeHashes(address, optio
txs.push(key.split('/')[4]); txs.push(key.split('/')[4]);
if (++total === options.limit)
return callback(null, txs);
next(); next();
}); });
})(); })();