Fix uninitialized HW.1/Nano and outputs swap with legacy firmware
This commit is contained in:
parent
92d2395e3d
commit
1b4c03ecc5
|
@ -114,13 +114,13 @@ class Ledger_Client():
|
||||||
try:
|
try:
|
||||||
firmware = self.dongleObject.getFirmwareVersion()['version'].split(".")
|
firmware = self.dongleObject.getFirmwareVersion()['version'].split(".")
|
||||||
if not checkFirmware(firmware):
|
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")
|
raise Exception("HW1 firmware version too old. Please update at https://www.ledgerwallet.com")
|
||||||
try:
|
try:
|
||||||
self.dongleObject.getOperationMode()
|
self.dongleObject.getOperationMode()
|
||||||
except BTChipException, e:
|
except BTChipException, e:
|
||||||
if (e.sw == 0x6985):
|
if (e.sw == 0x6985):
|
||||||
self.dongleObject.close()
|
self.dongleObject.dongle.close()
|
||||||
dialog = StartBTChipPersoDialog()
|
dialog = StartBTChipPersoDialog()
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
# Acquire the new client on the next run
|
# Acquire the new client on the next run
|
||||||
|
@ -260,6 +260,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||||
output = None
|
output = None
|
||||||
outputAmount = None
|
outputAmount = None
|
||||||
p2shTransaction = False
|
p2shTransaction = False
|
||||||
|
reorganize = False
|
||||||
pin = ""
|
pin = ""
|
||||||
self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
||||||
|
|
||||||
|
@ -339,6 +340,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||||
if not p2shTransaction:
|
if not p2shTransaction:
|
||||||
outputData = self.get_client().finalizeInput(output, format_satoshis_plain(outputAmount),
|
outputData = self.get_client().finalizeInput(output, format_satoshis_plain(outputAmount),
|
||||||
format_satoshis_plain(tx.get_fee()), changePath, bytearray(rawTx.decode('hex')))
|
format_satoshis_plain(tx.get_fee()), changePath, bytearray(rawTx.decode('hex')))
|
||||||
|
reorganize = True
|
||||||
else:
|
else:
|
||||||
outputData = self.get_client().finalizeInputFull(txOutput)
|
outputData = self.get_client().finalizeInputFull(txOutput)
|
||||||
outputData['outputData'] = txOutput
|
outputData['outputData'] = txOutput
|
||||||
|
@ -403,6 +405,10 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||||
inputIndex = inputIndex + 1
|
inputIndex = inputIndex + 1
|
||||||
updatedTransaction = format_transaction(transactionOutput, preparedTrustedInputs)
|
updatedTransaction = format_transaction(transactionOutput, preparedTrustedInputs)
|
||||||
updatedTransaction = hexlify(updatedTransaction)
|
updatedTransaction = hexlify(updatedTransaction)
|
||||||
|
|
||||||
|
if reorganize:
|
||||||
|
tx.update(updatedTransaction)
|
||||||
|
else:
|
||||||
tx.update_signatures(updatedTransaction)
|
tx.update_signatures(updatedTransaction)
|
||||||
self.signing = False
|
self.signing = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue