From 52c46e83edf2fc19de2dfb61f342c94d0965e11b Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 14 Jul 2016 16:03:29 -0700 Subject: [PATCH] add scanning test. --- lib/bcoin/chaindb.js | 2 +- test/chain-test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index 7b8ebec2..804b43de 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -1151,7 +1151,7 @@ ChainDB.prototype.scan = function scan(start, hashes, iter, callback) { for (i = 0; i < hashes.length; i++) hashMap[hashes[i]] = true; - this.logger.info('Rescanning from block %s.', utils.revHex(start)); + this.logger.info('Scanning from block %s.', utils.revHex(start)); (function next(err, hash) { if (err) diff --git a/test/chain-test.js b/test/chain-test.js index 5b36376c..b5076b37 100644 --- a/test/chain-test.js +++ b/test/chain-test.js @@ -218,6 +218,21 @@ describe('Chain', function() { }); }); + it('should rescan for transactions', function(cb) { + var txs = []; + walletdb.getAddresses(function(err, hashes) { + assert.ifError(err); + chain.db.scan(null, hashes, function(tx, block, next) { + txs.push(tx); + next(); + }, function(err) { + assert.ifError(err); + assert.equal(txs.length, 25); + cb(); + }); + }); + }); + it('should cleanup', function(cb) { constants.tx.COINBASE_MATURITY = 100; cb();