add scanning test.
This commit is contained in:
parent
dd70c3167b
commit
52c46e83ed
@ -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)
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user