diff --git a/lib/constants.js b/lib/constants.js index a496fc6..03ee0a4 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -35,10 +35,8 @@ Constants.BACKOFF_TIME = 2; Constants.MAX_MAIN_ADDRESS_GAP = 20; -// Fund scanning parameters -Constants.SCAN_CONFIG = { - maxGap: Constants.MAX_MAIN_ADDRESS_GAP, -}; +// TODO: should allow different gap sizes for external/internal chains +Constants.SCAN_ADDRESS_GAP = Constants.MAX_MAIN_ADDRESS_GAP; Constants.FEE_LEVELS = [{ name: 'priority', diff --git a/lib/server.js b/lib/server.js index 44ffe9b..61d3f58 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1937,7 +1937,7 @@ WalletService.prototype.scan = function(opts, cb) { function scanBranch(derivator, cb) { var inactiveCounter = 0; var allAddresses = []; - var gap = Constants.SCAN_CONFIG.maxGap; + var gap = Constants.SCAN_ADDRESS_GAP; async.whilst(function() { return inactiveCounter < gap; diff --git a/test/integration/server.js b/test/integration/server.js index 8204bcd..bc79bd1 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -4953,7 +4953,7 @@ describe('Wallet service', function() { describe('1-of-1 wallet (BIP44 & P2PKH)', function() { beforeEach(function(done) { this.timeout(5000); - Constants.SCAN_CONFIG.maxGap = 2; + Constants.SCAN_ADDRESS_GAP = 2; helpers.createAndJoinWallet(1, 1, function(s, w) { server = s; @@ -5145,7 +5145,7 @@ describe('Wallet service', function() { beforeEach(function(done) { this.timeout(5000); - Constants.SCAN_CONFIG.maxGap = 2; + Constants.SCAN_ADDRESS_GAP = 2; helpers.createAndJoinWallet(1, 2, { supportBIP44AndP2PKH: false @@ -5227,7 +5227,7 @@ describe('Wallet service', function() { var scanConfigOld = Constants.SCAN_CONFIG; beforeEach(function(done) { this.timeout(5000); - Constants.SCAN_CONFIG.maxGap = 2; + Constants.SCAN_ADDRESS_GAP = 2; helpers.createAndJoinWallet(1, 1, { supportBIP44AndP2PKH: false @@ -5296,7 +5296,7 @@ describe('Wallet service', function() { }); it('should start multiple asynchronous scans for different wallets', function(done) { helpers.stubAddressActivity(['3K2VWMXheGZ4qG35DyGjA2dLeKfaSr534A']); - Constants.SCAN_CONFIG.scanWindow = 1; + Constants.SCAN_ADDRESS_GAP = 1; var scans = 0; server.messageBroker.onMessage(function(n) {