commit 788b5b04febf45da891b1a85990385d06c6f14bc
parent a61953673a3503d780ee8a1135f21b9edbab8d33
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 2 Oct 2018 15:52:24 +0200
ledger: always use finalizeInput in sign_transaction
related #4749
Diffstat:
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/electrum/plugins/ledger/ledger.py b/electrum/plugins/ledger/ledger.py
@@ -318,7 +318,6 @@ class Ledger_KeyStore(Hardware_KeyStore):
chipInputs = []
redeemScripts = []
signatures = []
- preparedTrustedInputs = []
changePath = ""
output = None
p2shTransaction = False
@@ -377,8 +376,8 @@ class Ledger_KeyStore(Hardware_KeyStore):
self.give_error("P2SH / regular input mixed in same transaction not supported") # should never happen
txOutput = var_int(len(tx.outputs()))
- for txout in tx.outputs():
- output_type, addr, amount = txout
+ for o in tx.outputs():
+ output_type, addr, amount = o.type, o.address, o.value
txOutput += int_to_hex(amount, 8)
script = tx.pay_script(output_type, addr)
txOutput += var_int(len(script)//2)
@@ -442,14 +441,10 @@ class Ledger_KeyStore(Hardware_KeyStore):
if segwitTransaction:
self.get_client().startUntrustedTransaction(True, inputIndex,
chipInputs, redeemScripts[inputIndex])
- if changePath:
- # we don't set meaningful outputAddress, amount and fees
- # as we only care about the alternateEncoding==True branch
- outputData = self.get_client().finalizeInput(b'', 0, 0, changePath, bfh(rawTx))
- else:
- outputData = self.get_client().finalizeInputFull(txOutput)
+ # we don't set meaningful outputAddress, amount and fees
+ # as we only care about the alternateEncoding==True branch
+ outputData = self.get_client().finalizeInput(b'', 0, 0, changePath, bfh(rawTx))
outputData['outputData'] = txOutput
- transactionOutput = outputData['outputData']
if outputData['confirmationNeeded']:
outputData['address'] = output
self.handler.finished()
@@ -469,16 +464,11 @@ class Ledger_KeyStore(Hardware_KeyStore):
else:
while inputIndex < len(inputs):
self.get_client().startUntrustedTransaction(firstTransaction, inputIndex,
- chipInputs, redeemScripts[inputIndex])
- if changePath:
- # we don't set meaningful outputAddress, amount and fees
- # as we only care about the alternateEncoding==True branch
- outputData = self.get_client().finalizeInput(b'', 0, 0, changePath, bfh(rawTx))
- else:
- outputData = self.get_client().finalizeInputFull(txOutput)
+ chipInputs, redeemScripts[inputIndex])
+ # we don't set meaningful outputAddress, amount and fees
+ # as we only care about the alternateEncoding==True branch
+ outputData = self.get_client().finalizeInput(b'', 0, 0, changePath, bfh(rawTx))
outputData['outputData'] = txOutput
- if firstTransaction:
- transactionOutput = outputData['outputData']
if outputData['confirmationNeeded']:
outputData['address'] = output
self.handler.finished()