|
|
@ -432,9 +432,9 @@ WalletService.prototype.verifyMessageSignature = function(opts, cb) { |
|
|
|
|
|
|
|
WalletService.prototype._getBlockchainExplorer = function(provider, network) { |
|
|
|
if (!this.blockchainExplorer) { |
|
|
|
var opts = {}; |
|
|
|
var opts = {}; |
|
|
|
if (this.blockchainExplorerOpts && this.blockchainExplorerOpts[network]) { |
|
|
|
opts = this.blockchainExplorerOpts[network]; |
|
|
|
opts = this.blockchainExplorerOpts[network]; |
|
|
|
} |
|
|
|
opts.provider = provider; |
|
|
|
opts.network = network; |
|
|
@ -1164,7 +1164,7 @@ WalletService.prototype.scan = function(opts, cb) { |
|
|
|
function deriveAddresses(size, derivator, cb) { |
|
|
|
async.mapSeries(_.range(size), function(i, next) { |
|
|
|
setTimeout(function() { |
|
|
|
next(null, derivator()); |
|
|
|
next(null, derivator.derive()); |
|
|
|
}, WalletService.scanConfig.DERIVATION_DELAY) |
|
|
|
}, cb); |
|
|
|
}; |
|
|
@ -1184,10 +1184,14 @@ WalletService.prototype.scan = function(opts, cb) { |
|
|
|
deriveAddresses(WalletService.scanConfig.SCAN_WINDOW, derivator, function(err, addresses) { |
|
|
|
if (err) return next(err); |
|
|
|
networkName = networkName || Bitcore.Address(addresses[0].address).toObject().network; |
|
|
|
allAddresses.push(addresses); |
|
|
|
checkActivity(_.pluck(addresses, 'address'), networkName, function(err, thereIsActivity) { |
|
|
|
if (err) return next(new Error('Could not fetch TX activity:' + err)); |
|
|
|
activity = thereIsActivity; |
|
|
|
if (thereIsActivity) { |
|
|
|
allAddresses.push(addresses); |
|
|
|
} else { |
|
|
|
derivator.rewind(WalletService.scanConfig.SCAN_WINDOW); |
|
|
|
} |
|
|
|
next(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1208,10 +1212,16 @@ WalletService.prototype.scan = function(opts, cb) { |
|
|
|
|
|
|
|
var derivators = []; |
|
|
|
_.each([false, true], function(isChange) { |
|
|
|
derivators.push(_.bind(wallet.createAddress, wallet, isChange)); |
|
|
|
derivators.push({ |
|
|
|
derive: _.bind(wallet.createAddress, wallet, isChange), |
|
|
|
rewind: _.bind(wallet.addressManager.rewindIndex, wallet.addressManager, isChange), |
|
|
|
}); |
|
|
|
if (opts.includeCopayerBranches) { |
|
|
|
_.each(wallet.copayers, function(copayer) { |
|
|
|
derivators.push(_.bind(copayer.createAddress, copayer, wallet, isChange)); |
|
|
|
derivators.push({ |
|
|
|
derive: _.bind(copayer.createAddress, copayer, wallet, isChange), |
|
|
|
rewind: _.bind(copayer.addressManager.rewindIndex, copayer.addressManager, isChange), |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|