|
|
@ -1169,21 +1169,23 @@ WalletService.prototype.scan = function(opts, cb) { |
|
|
|
}, cb); |
|
|
|
}; |
|
|
|
|
|
|
|
function checkActivity(addresses, cb) { |
|
|
|
var bc = self._getBlockchainExplorer(); |
|
|
|
function checkActivity(addresses, networkName, cb) { |
|
|
|
var bc = self._getBlockchainExplorer('insight', networkName); |
|
|
|
bc.getAddressActivity(addresses, cb); |
|
|
|
}; |
|
|
|
|
|
|
|
function scanBranch(derivator, cb) { |
|
|
|
var activity = true; |
|
|
|
var allAddresses = []; |
|
|
|
var networkName; |
|
|
|
async.whilst(function() { |
|
|
|
return activity; |
|
|
|
}, function(next) { |
|
|
|
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'), function(err, thereIsActivity) { |
|
|
|
checkActivity(_.pluck(addresses, 'address'), networkName, function(err, thereIsActivity) { |
|
|
|
if (err) return next(new Error('Could not fetch TX activity:' + err)); |
|
|
|
activity = thereIsActivity; |
|
|
|
next(); |
|
|
|