clean up address scan config

This commit is contained in:
Ivan Socolsky 2015-10-30 15:39:33 -03:00
parent eb006c3db3
commit d451fff6fc
3 changed files with 7 additions and 9 deletions

View File

@ -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',

View File

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

View File

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