Fix creating transaction with no priv key

This commit is contained in:
Gustavo Maximiliano Cortez 2016-12-14 15:26:56 -03:00
commit 92a21046b2
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 26 additions and 25 deletions

View file

@ -483,20 +483,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}
});
return;
}
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
return walletService.onlyPublish(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
});
}
}
ongoingProcess.set('creatingTx', true, onSendStatusChange);
createTx(wallet, false, function(err, txp) {
ongoingProcess.set('creatingTx', false, onSendStatusChange);
if (err) return;
if (err) return;
var config = configService.getSync();
var spendingPassEnabled = walletService.isEncrypted(wallet);
@ -539,7 +531,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
function statusChangeHandler(processName, showName, isOn) {
$log.debug('statusChangeHandler: ', processName, showName, isOn);
if ((processName === 'broadcastingTx' || ((processName === 'signingTx') && $scope.wallet.m > 1)) && !isOn) {
if (
(
processName === 'broadcastingTx' ||
((processName === 'signingTx') && $scope.wallet.m > 1) ||
(processName == 'sendingTx' && !$scope.wallet.canSign() && !$scope.wallet.isPrivKeyExternal())
) && !isOn) {
$scope.sendStatus = 'success';
$scope.$digest();
} else if (showName) {
@ -760,6 +757,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
};
function publishAndSign(wallet, txp, onSendStatusChange) {
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
return walletService.onlyPublish(wallet, txp, function(err) {
if (err) setSendError(err);
}, onSendStatusChange);
}
walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err);

View file

@ -889,20 +889,14 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
root.onlyPublish = function(wallet, txp, cb) {
ongoingProcess.set('sendingTx', true);
root.onlyPublish = function(wallet, txp, cb, customStatusHandler) {
ongoingProcess.set('sendingTx', true, customStatusHandler);
root.publishTx(wallet, txp, function(err, publishedTxp) {
root.invalidateCache(wallet);
ongoingProcess.set('sendingTx', false);
if (err) return cb(err);
var type = root.getViewStatus(wallet, createdTxp);
root.openStatusModal(type, createdTxp, function() {
$rootScope.$emit('Local/TxAction', wallet.id);
return;
});
return cb(null, publishedTxp);
ongoingProcess.set('sendingTx', false, customStatusHandler);
if (err) return cb(bwcError.msg(err));
$rootScope.$emit('Local/TxAction', wallet.id);
return cb();
});
};

View file

@ -137,8 +137,9 @@
slide-success-show="sendStatus === 'success'"
slide-success-on-confirm="onSuccessConfirm()"
slide-success-hide-on-confirm="true">
<span ng-hide="wallet.m > 1">Payment Sent</span>
<span ng-show="wallet.m > 1">Proposal Created</span>
<span ng-show="wallet.m == 1 && (wallet.canSign() || wallet.isPrivKeyExternal())">Payment Sent</span>
<span ng-show="wallet.m > 1 && (wallet.canSign() || wallet.isPrivKeyExternal())">Proposal Created</span>
<span ng-show="!wallet.canSign() && !wallet.isPrivKeyExternal()">Transaction created</span>
<div ng-show="isGlidera" class="glidera-success">
<span ng-show="isGlidera == 'buy'">A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business day</span>
<span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account. Should arrive in 4-6 business days</span>