add scanning test.

This commit is contained in:
Christopher Jeffrey 2016-07-14 16:03:29 -07:00
parent dd70c3167b
commit 52c46e83ed
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 16 additions and 1 deletions

View File

@ -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)

View File

@ -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();