send BalanceUpdated notification as global

This commit is contained in:
Ivan Socolsky 2016-01-13 11:20:22 -03:00
parent 57e5a743e8
commit f2c29d8dee
1 changed files with 7 additions and 5 deletions

View File

@ -614,8 +614,8 @@ WalletService.prototype.joinWallet = function(opts, cb) {
}
if (_.find(wallet.copayers, {
xPubKey: opts.xPubKey
})) return cb(Errors.COPAYER_IN_WALLET);
xPubKey: opts.xPubKey
})) return cb(Errors.COPAYER_IN_WALLET);
if (wallet.copayers.length == wallet.n) return cb(Errors.WALLET_FULL);
@ -708,8 +708,8 @@ WalletService.prototype._canCreateAddress = function(ignoreMaxGap, cb) {
isChange: true
}), Defaults.MAX_MAIN_ADDRESS_GAP);
if (latestAddresses.length < Defaults.MAX_MAIN_ADDRESS_GAP || _.any(latestAddresses, {
hasActivity: true
})) return cb(null, true);
hasActivity: true
})) return cb(null, true);
var bc = self._getBlockchainExplorer(latestAddresses[0].network);
var activityFound = false;
@ -1101,7 +1101,9 @@ WalletService.prototype.getBalance = function(opts, cb) {
if (err) return;
if (!_.isEqual(partialBalance, fullBalance)) {
log.debug('Cache miss: balance in active addresses differs from final balance');
self._notify('BalanceUpdated', fullBalance);
self._notify('BalanceUpdated', fullBalance, {
isGlobal: true
});
}
});
}, 1);