From 55aa4e8f68a7362323a1a657ba85fe33911db0ed Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Wed, 3 Sep 2014 11:27:58 -0300 Subject: [PATCH] Added call from UX --- js/models/core/Wallet.js | 7 ++++--- js/services/controllerUtils.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 8de654705..a4d5e3380 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -1528,6 +1528,7 @@ Wallet.prototype.getUnspent = function(cb) { Wallet.prototype.removeTxWithSpentInputs = function(cb) { var self = this; + cb = cb || function () {}; var txps = this.getTxProposals(); var inputs = []; @@ -1540,9 +1541,7 @@ Wallet.prototype.removeTxWithSpentInputs = function(cb) { return; this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) { - if (err) { - return cb(err); - } + if (err) return cb(err); unspentList.forEach(function (unspent) { inputs.forEach(function (input) { @@ -1558,6 +1557,8 @@ Wallet.prototype.removeTxWithSpentInputs = function(cb) { self.emit('txProposalsUpdated'); self.store(); + + cb(null); }); }; diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index ba0c9d2d6..d307d2b63 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -166,6 +166,8 @@ angular.module('copayApp.services') if (!w) return root.onErrorDigest(); if (!w.isReady()) return; + w.removeTxWithSpentInputs(); + $rootScope.balanceByAddr = {}; $rootScope.updatingBalance = true;