txdb: zap assert.

This commit is contained in:
Christopher Jeffrey 2016-10-05 19:35:34 -07:00
parent eee6866319
commit 1b489f42cd
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1919,6 +1919,7 @@ TXDB.prototype.getAccountBalance = co(function* getBalance(account) {
TXDB.prototype.zap = co(function* zap(account, age) {
var hashes = [];
var now = utils.now();
var i, txs, tx, hash;
if (!utils.isUInt32(age))
@ -1926,7 +1927,7 @@ TXDB.prototype.zap = co(function* zap(account, age) {
txs = yield this.getRange(account, {
start: 0,
end: utils.now() - age
end: now - age
});
for (i = 0; i < txs.length; i++) {
@ -1936,6 +1937,8 @@ TXDB.prototype.zap = co(function* zap(account, age) {
if (tx.ts !== 0)
continue;
assert(now - tx.ps >= age);
this.wallet.start();
this.logger.debug('Zapping TX: %s (%s)',