add derivation delay
This commit is contained in:
parent
cdd1e9ea58
commit
9ad89452cb
|
@ -1045,7 +1045,8 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
|||
|
||||
|
||||
WalletService.scanConfig = {
|
||||
SCAN_WINDOW: 10,
|
||||
SCAN_WINDOW: 20,
|
||||
DERIVATION_DELAY: 10, // in milliseconds
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1063,7 +1064,9 @@ WalletService.prototype.scan = function(opts, cb) {
|
|||
|
||||
function deriveAddresses(size, isChange, derivator, cb) {
|
||||
async.map(_.range(size), function(i, next) {
|
||||
next(null, derivator(isChange));
|
||||
setTimeout(function() {
|
||||
next(null, derivator(isChange));
|
||||
}, WalletService.scanConfig.DERIVATION_DELAY)
|
||||
}, cb);
|
||||
};
|
||||
|
||||
|
|
|
@ -2481,12 +2481,13 @@ describe('Wallet service', function() {
|
|||
});
|
||||
|
||||
describe('#scan', function() {
|
||||
var scanWindowOld = WalletService.scanConfig.SCAN_WINDOW;
|
||||
var scanConfigOld = WalletService.scanConfig;
|
||||
beforeEach(function() {
|
||||
WalletService.scanConfig.SCAN_WINDOW = 2;
|
||||
WalletService.scanConfig.DERIVATION_DELAY = 0;
|
||||
});
|
||||
afterEach(function() {
|
||||
WalletService.scanConfig.SCAN_WINDOW = scanWindowOld;
|
||||
WalletService.scanConfig = scanConfigOld;
|
||||
});
|
||||
|
||||
it('should scan main addresses', function(done) {
|
||||
|
|
Loading…
Reference in New Issue