fix signing multiple inputs with ledger

This commit is contained in:
Matias Alejo Garcia 2015-09-14 12:12:24 -03:00
commit 9dc2c40242
3 changed files with 19 additions and 10 deletions

View file

@ -740,9 +740,17 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return; return;
}; };
var comment = form.comment.$modelValue;
// ToDo: use a credential's (or fc's) function for this
if (comment && !fc.credentials.sharedEncryptingKey) {
var msg = 'Could not add message to imported wallet without shared encrypting key';
$log.warn(msg);
return self.setSendError(gettext(msg));
}
self.setOngoingProcess(gettext('Creating transaction')); self.setOngoingProcess(gettext('Creating transaction'));
$timeout(function() { $timeout(function() {
var comment = form.comment.$modelValue;
var paypro = self._paypro; var paypro = self._paypro;
var address, amount; var address, amount;

View file

@ -103,6 +103,8 @@ angular.module('copayApp.services')
body = err.message || err.code; body = err.message || err.code;
break; break;
} }
} else {
body = gettextCatalog.getString(err);
} }
var msg = prefix + ( body ? ': ' + body : ''); var msg = prefix + ( body ? ': ' + body : '');

View file

@ -562,7 +562,7 @@ angular.module('copayApp.services')
return lodash.sortBy(ret, 'name'); return lodash.sortBy(ret, 'name');
}; };
root._signWithLedger = function(txp,cb) { root._signWithLedger = function(txp, cb) {
var fc = root.focusedClient; var fc = root.focusedClient;
$log.info('Requesting Ledger Chrome app to sign the transaction'); $log.info('Requesting Ledger Chrome app to sign the transaction');
@ -570,11 +570,10 @@ angular.module('copayApp.services')
if (!result.success) if (!result.success)
return cb(result); return cb(result);
txp.signatures = []; txp.signatures = lodash.map(result.signatures, function(s) {
for (var i=0; i<result.signatures.length; i++) { return s.substring(0, s.length - 2);
txp.signatures.push(result.signatures[i].substring(0, result.signatures[i].length - 2)); });
return fc.signTxProposal(txp, cb); return fc.signTxProposal(txp, cb);
}
}); });
}; };
@ -587,7 +586,7 @@ angular.module('copayApp.services')
$log.error(msg); $log.error(msg);
return cb(msg); return cb(msg);
} }
return root._signWithLedger(txp,cb); return root._signWithLedger(txp, cb);
} else { } else {
return fc.signTxProposal(txp, function(err, signedTxp) { return fc.signTxProposal(txp, function(err, signedTxp) {
root.lockFC(); root.lockFC();