|
|
@ -25,6 +25,12 @@ try: |
|
|
|
except ImportError: |
|
|
|
BTCHIP = False |
|
|
|
|
|
|
|
MSG_NEEDS_FW_UPDATE_GENERIC = _('Firmware version too old. Please update at') + \ |
|
|
|
' https://www.ledgerwallet.com' |
|
|
|
MSG_NEEDS_FW_UPDATE_SEGWIT = _('Firmware version (or "Bitcoin" app) too old for Segwit support. Please update at') + \ |
|
|
|
' https://www.ledgerwallet.com' |
|
|
|
|
|
|
|
|
|
|
|
class Ledger_Client(): |
|
|
|
def __init__(self, hidDevice): |
|
|
|
self.dongleObject = btchip(hidDevice) |
|
|
@ -57,9 +63,9 @@ class Ledger_Client(): |
|
|
|
#self.get_client() # prompt for the PIN before displaying the dialog if necessary |
|
|
|
#self.handler.show_message("Computing master public key") |
|
|
|
if xtype in ['p2wpkh', 'p2wsh'] and not self.supports_native_segwit(): |
|
|
|
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com") |
|
|
|
raise Exception(MSG_NEEDS_FW_UPDATE_SEGWIT) |
|
|
|
if xtype in ['p2wpkh-p2sh', 'p2wsh-p2sh'] and not self.supports_segwit(): |
|
|
|
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com") |
|
|
|
raise Exception(MSG_NEEDS_FW_UPDATE_SEGWIT) |
|
|
|
splitPath = bip32_path.split('/') |
|
|
|
if splitPath[0] == 'm': |
|
|
|
splitPath = splitPath[1:] |
|
|
@ -119,7 +125,7 @@ class Ledger_Client(): |
|
|
|
|
|
|
|
if not checkFirmware(firmware): |
|
|
|
self.dongleObject.dongle.close() |
|
|
|
raise Exception("HW1 firmware version too old. Please update at https://www.ledgerwallet.com") |
|
|
|
raise Exception(MSG_NEEDS_FW_UPDATE_GENERIC) |
|
|
|
try: |
|
|
|
self.dongleObject.getOperationMode() |
|
|
|
except BTChipException as e: |
|
|
@ -285,12 +291,12 @@ class Ledger_KeyStore(Hardware_KeyStore): |
|
|
|
|
|
|
|
if txin['type'] in ['p2wpkh-p2sh', 'p2wsh-p2sh']: |
|
|
|
if not self.get_client_electrum().supports_segwit(): |
|
|
|
self.give_error("Firmware version too old to support segwit. Please update at https://www.ledgerwallet.com") |
|
|
|
self.give_error(MSG_NEEDS_FW_UPDATE_SEGWIT) |
|
|
|
segwitTransaction = True |
|
|
|
|
|
|
|
if txin['type'] in ['p2wpkh', 'p2wsh']: |
|
|
|
if not self.get_client_electrum().supports_native_segwit(): |
|
|
|
self.give_error("Firmware version too old to support native segwit. Please update at https://www.ledgerwallet.com") |
|
|
|
self.give_error(MSG_NEEDS_FW_UPDATE_SEGWIT) |
|
|
|
segwitTransaction = True |
|
|
|
|
|
|
|
pubkeys, x_pubkeys = tx.get_sorted_pubkeys(txin) |
|
|
|