diff --git a/public/views/walletHome.html b/public/views/walletHome.html
index 86c4dd3d1..a7453ec7e 100644
--- a/public/views/walletHome.html
+++ b/public/views/walletHome.html
@@ -297,7 +297,7 @@
{{index.lockedBalanceStr}}
- in pending payments
+ locked by pending payments
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js
index 15479db48..d3e2a9bec 100644
--- a/src/js/controllers/index.js
+++ b/src/js/controllers/index.js
@@ -159,29 +159,20 @@ angular.module('copayApp.controllers').controller('indexController', function($r
};
var _walletStatusHash = function(walletStatus) {
- var st = {};
-
+ var bal;
if (walletStatus) {
- st.bal = walletStatus.balance.totalAmount;
- st.txs = walletStatus.pendingTxps;
+ bal = walletStatus.balance.totalAmount;
} else {
- st.bal = self.totalBalanceSat;
- st.txs = self.txps;
+ bal = self.totalBalanceSat;
}
-
- var hash = st.bal + ':';
- if (st.txs) {
- hash += lodash.map(st.txs, function(t) {
- return t.id + ':' + (t.actions ? t.actions.length : 0);
- }).join(':');
- }
- return hash;
+ return bal;
};
self.updateAll = function(walletStatus, untilItChanges, initStatusHash, tries) {
tries = tries || 0;
if (untilItChanges && lodash.isUndefined(initStatusHash)) {
initStatusHash = _walletStatusHash();
+ $log.debug('Updating status until it changes. initStatusHash:' + initStatusHash)
}
var get = function(cb) {
if (walletStatus)
@@ -206,8 +197,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setOngoingProcess('updatingStatus', true);
$log.debug('Updating Status:', fc, tries);
get(function(err, walletStatus) {
- if (!err && untilItChanges && initStatusHash == _walletStatusHash(walletStatus) && tries < 7) {
+ var currentStatusHash = _walletStatusHash(walletStatus);
+ $log.debug('Status update. hash:' + currentStatusHash + ' Try:'+ tries);
+ if (!err && untilItChanges && initStatusHash == currentStatusHash && tries < 7) {
return $timeout(function() {
+ $log.debug('Retrying update... Try:' + tries)
return self.updateAll(null, true, initStatusHash, ++tries);
}, 1400 * tries);
}
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js
index 6b915b188..9666d3589 100644
--- a/src/js/controllers/walletHome.js
+++ b/src/js/controllers/walletHome.js
@@ -127,6 +127,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.openTxpModal = function(tx, copayers) {
var fc = profileService.focusedClient;
+ var refreshUntilItChanges = false;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.error = null;
$scope.tx = tx;
@@ -136,7 +137,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.copayerId = fc.credentials.copayerId;
$scope.loading = null;
$scope.color = fc.backgroundColor;
- $scope.refreshUntilItChanges = false;
+ refreshUntilItChanges = false;
$scope.getShortNetworkName = function() {
return fc.credentials.networkName.substring(0, 4);
@@ -219,12 +220,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.error = gettext('Could not broadcast payment. Check you connection and try again');
$scope.$digest();
} else {
-
- console.log('[walletHome.js.219]'); //TODO
+ $log.debug('Transaction signed and broadcasted')
if (memo)
$log.info(memo);
- $scope.refreshUntilItChanges = true;
+ refreshUntilItChanges = true;
$modalInstance.close(txpsb);
}
});
@@ -250,7 +250,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.error = err.message || gettext('Could not reject payment. Check you connection and try again');
$scope.$digest();
} else {
- $scope.refreshUntilItChanges = true;
$modalInstance.close(txpr);
}
});
@@ -274,7 +273,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.$digest();
return;
}
- $scope.refreshUntilItChanges = true;
$modalInstance.close();
});
}, 100);
@@ -297,7 +295,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (memo)
$log.info(memo);
- $scope.refreshUntilItChanges = true;
+ refreshUntilItChanges = true;
$modalInstance.close(txpb);
}
});
@@ -329,11 +327,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess();
if (txp) {
txStatus.notify(txp, function() {
- $scope.$emit('Local/TxProposalAction', $scope.refreshUntilItChanges);
+ $scope.$emit('Local/TxProposalAction', refreshUntilItChanges);
});
} else {
$timeout(function() {
- $scope.$emit('Local/TxProposalAction', $scope.refreshUntilItChanges);
+ $scope.$emit('Local/TxProposalAction', refreshUntilItChanges);
}, 100);
}
});