refreshing wallet clears balance cache

This commit is contained in:
Ivan Socolsky 2014-10-16 16:02:32 -03:00 committed by Matias Alejo Garcia
commit 2beda0c354
2 changed files with 5 additions and 0 deletions

View file

@ -39,6 +39,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
if (w.isReady()) {
w.sendWalletReady();
if ($rootScope.addrInfos.length > 0) {
controllerUtils.clearBalanceCache(w);
controllerUtils.updateBalance(w, function() {
$rootScope.$digest();
});

View file

@ -240,6 +240,10 @@ angular.module('copayApp.services')
};
var _balanceCache = {};
root.clearBalanceCache = function(w) {
delete _balanceCache[w.getId()];
};
root.updateBalance = function(w, cb) {
var updateScope = function(w, data, cb2) {
var satToUnit = 1 / w.settings.unitToSatoshi;