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;