tMerge pull request #1997 from btchip/hw1-fixes - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 4c2113326c6d605e52ff79ac6678c68f6fe22a64 DIR parent 85849fb760e724269dfdca907f3ced99be7f39f5 HTML Author: ThomasV <thomasv@electrum.org> Date: Mon, 24 Oct 2016 15:48:00 +0200 Merge pull request #1997 from btchip/hw1-fixes Fix uninitialized HW.1/Nano and outputs swap with legacy firmware Diffstat: M plugins/ledger/ledger.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- DIR diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py t@@ -114,13 +114,13 @@ class Ledger_Client(): try: firmware = self.dongleObject.getFirmwareVersion()['version'].split(".") if not checkFirmware(firmware): - self.dongleObject.close() + self.dongleObject.dongle.close() raise Exception("HW1 firmware version too old. Please update at https://www.ledgerwallet.com") try: self.dongleObject.getOperationMode() except BTChipException, e: if (e.sw == 0x6985): - self.dongleObject.close() + self.dongleObject.dongle.close() dialog = StartBTChipPersoDialog() dialog.exec_() # Acquire the new client on the next run t@@ -260,6 +260,7 @@ class Ledger_KeyStore(Hardware_KeyStore): output = None outputAmount = None p2shTransaction = False + reorganize = False pin = "" self.get_client() # prompt for the PIN before displaying the dialog if necessary t@@ -339,6 +340,7 @@ class Ledger_KeyStore(Hardware_KeyStore): if not p2shTransaction: outputData = self.get_client().finalizeInput(output, format_satoshis_plain(outputAmount), format_satoshis_plain(tx.get_fee()), changePath, bytearray(rawTx.decode('hex'))) + reorganize = True else: outputData = self.get_client().finalizeInputFull(txOutput) outputData['outputData'] = txOutput t@@ -403,7 +405,11 @@ class Ledger_KeyStore(Hardware_KeyStore): inputIndex = inputIndex + 1 updatedTransaction = format_transaction(transactionOutput, preparedTrustedInputs) updatedTransaction = hexlify(updatedTransaction) - tx.update_signatures(updatedTransaction) + + if reorganize: + tx.update(updatedTransaction) + else: + tx.update_signatures(updatedTransaction) self.signing = False def password_dialog(self, msg=None):