Merge pull request #433 from isocolsky/fix/2-step

Fix 2-step balance computation
This commit is contained in:
Matias Alejo Garcia 2016-01-13 12:12:48 -03:00
commit 46c92e2248
1 changed files with 9 additions and 7 deletions

View File

@ -1059,9 +1059,9 @@ WalletService.prototype._getActiveAddresses = function(cb) {
var result = _.union(active, recent);
var index = _.indexBy(allAddresses, 'address');
result = _.map(result, function(r) {
result = _.compact(_.map(result, function(r) {
return index[r];
});
}));
return cb(null, result);
});
});
@ -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);