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')) if (msg.match('expired'))
msg = 'The payment request has 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' : '') + var message = 'The transaction' + ($scope.requiresMultipleSignatures ? ' proposal' : '') +
' could not be created: ' + msg; ' could not be created: ' + msg;
@ -203,12 +206,15 @@ angular.module('copayApp.controllers').controller('SendController',
}, function (err, txid, status) { }, function (err, txid, status) {
$scope.loading = false; $scope.loading = false;
if ($scope.isWindowsPhoneApp) if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = false; $rootScope.wpInputFocused = false;
if (err) if (err) {
return $scope.setError(err); $scope.setError(err);
txStatus.notify(status); }
$scope.resetForm(); else {
txStatus.notify(status);
$scope.resetForm();
}
}); });
}, 100); }, 100);
}; };

View file

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