diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 7165a6f54..c51493f57 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -594,7 +594,7 @@ angular.module('copayApp.services') var fc = root.focusedClient; $log.info('Requesting Ledger Chrome app to sign the transaction'); - ledger.signTx(txp, 0, function(result) { + ledger.signTx(txp, fc.credentials.account, function(result) { $log.debug('Ledger response', result); if (!result.success) return cb(result.message || result.error); @@ -612,7 +612,7 @@ angular.module('copayApp.services') $log.info('Requesting Trezor to sign the transaction'); var xPubKeys = lodash.pluck(fc.credentials.publicKeyRing, 'xPubKey'); - trezor.signTx(xPubKeys, txp, 0, function(err, result) { + trezor.signTx(xPubKeys, txp, fc.credentials.account, function(err, result) { if (err) return cb(err); $log.debug('Trezor response', result); diff --git a/src/js/services/trezor.js b/src/js/services/trezor.js index 6f2b89608..295b0f05f 100644 --- a/src/js/services/trezor.js +++ b/src/js/services/trezor.js @@ -91,8 +91,11 @@ angular.module('copayApp.services') if (txp.addressType == 'P2PKH') { + $log.debug("Trezor signing uni-sig p2pkh. Account:", account); + var inAmount = 0; inputs = lodash.map(txp.inputs, function(i) { + $log.debug("Trezor TX input path:", i.path); var pathArr = i.path.split('/'); var n = [hwWallet.UNISIG_ROOTPATH | 0x80000000, 0 | 0x80000000, account | 0x80000000, parseInt(pathArr[1]), parseInt(pathArr[2])]; inAmount += i.satoshis; @@ -105,6 +108,7 @@ angular.module('copayApp.services') var change = inAmount - txp.fee - txp.amount; if (change > 0) { + $log.debug("Trezor TX change path:", txp.changeAddress.path); var pathArr = txp.changeAddress.path.split('/'); var n = [hwWallet.UNISIG_ROOTPATH | 0x80000000, 0 | 0x80000000, account | 0x80000000, parseInt(pathArr[1]), parseInt(pathArr[2])]; @@ -119,6 +123,7 @@ angular.module('copayApp.services') // P2SH Wallet, multisig wallet var inAmount = 0; + $log.debug("Trezor signing multi-sig p2sh. Account:", account); var sigs = xPubKeys.map(function(v) { return ''; @@ -126,6 +131,7 @@ angular.module('copayApp.services') inputs = lodash.map(txp.inputs, function(i) { + $log.debug("Trezor TX input path:", i.path); var pathArr = i.path.split('/'); var n = [hwWallet.MULTISIG_ROOTPATH | 0x80000000, 0 | 0x80000000, account | 0x80000000, parseInt(pathArr[1]), parseInt(pathArr[2])]; var np = n.slice(3); @@ -155,6 +161,7 @@ angular.module('copayApp.services') var change = inAmount - txp.fee - txp.amount; if (change > 0) { + $log.debug("Trezor TX change path:", txp.changeAddress.path); var pathArr = txp.changeAddress.path.split('/'); var n = [hwWallet.MULTISIG_ROOTPATH | 0x80000000, 0 | 0x80000000, account | 0x80000000, parseInt(pathArr[1]), parseInt(pathArr[2])]; var np = n.slice(3);