Catch error when transaction could not be sent. Update locked balance if transaction failed

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-13 17:39:30 -03:00
commit 7ffd483807
2 changed files with 12 additions and 5 deletions

View file

@ -163,6 +163,9 @@ angular.module('copayApp.controllers').controller('SendController',
if (msg.match('expired'))
msg = 'The payment request has expired';
if (msg.match('XMLHttpRequest'))
msg = 'Error when sending to the blockchain. Resend it from Home';
var message = 'The transaction' + ($scope.requiresMultipleSignatures ? ' proposal' : '') +
' could not be created: ' + msg;
@ -203,12 +206,15 @@ angular.module('copayApp.controllers').controller('SendController',
}, function (err, txid, status) {
$scope.loading = false;
if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = false;
$rootScope.wpInputFocused = false;
if (err)
return $scope.setError(err);
txStatus.notify(status);
$scope.resetForm();
if (err) {
$scope.setError(err);
}
else {
txStatus.notify(status);
$scope.resetForm();
}
});
}, 100);
};

View file

@ -1651,6 +1651,7 @@ Wallet.prototype.broadcastToBitcoinNetwork = function(ntxid, cb) {
log.debug('Wallet:' + self.getName() + ' Send failed:' + err);
self._checkIfTxIsSent(ntxid, function(err, txid) {
self.emitAndKeepAlive('balanceUpdated');
return cb(err, txid);
});
} else {