diff --git a/lib/transaction.py b/lib/transaction.py index 0620126f3..3fd17b2b3 100644 --- a/lib/transaction.py +++ b/lib/transaction.py @@ -682,8 +682,12 @@ class Transaction: return value_field + witness @classmethod - def is_segwit_input(self, txin): - return txin['type'] in ['p2wpkh', 'p2wpkh-p2sh', 'p2wsh', 'p2wsh-p2sh'] + def is_segwit_input(cls, txin): + return cls.is_segwit_inputtype(txin['type']) + + @classmethod + def is_segwit_inputtype(cls, txin_type): + return txin_type in ('p2wpkh', 'p2wpkh-p2sh', 'p2wsh', 'p2wsh-p2sh') @classmethod def input_script(self, txin, estimate_size=False): diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py index 0b24587be..93582dca5 100644 --- a/plugins/ledger/ledger.py +++ b/plugins/ledger/ledger.py @@ -438,15 +438,21 @@ class Ledger_KeyStore(Hardware_KeyStore): def show_address(self, sequence, txin_type): self.signing = True - # prompt for the PIN before displaying the dialog if necessary client = self.get_client() address_path = self.get_derivation()[2:] + "/%d/%d"%sequence self.handler.show_message(_("Showing address ...")) - segwit = txin_type in ['p2wpkh', 'p2wsh', 'p2wpkh-p2sh', 'p2wsh-p2sh'] + segwit = Transaction.is_segwit_inputtype(txin_type) try: - self.get_client().getWalletPublicKey(address_path, showOnScreen=True, segwit=segwit) - except: - pass + client.getWalletPublicKey(address_path, showOnScreen=True, segwit=segwit) + except BTChipException as e: + if e.sw == 0x6985: # cancelled by user + pass + else: + traceback.print_exc(file=sys.stderr) + self.handler.show_error(e) + except BaseException as e: + traceback.print_exc(file=sys.stderr) + self.handler.show_error(e) finally: self.handler.finished() self.signing = False diff --git a/plugins/ledger/qt.py b/plugins/ledger/qt.py index 8880b89bc..cfdd7c383 100644 --- a/plugins/ledger/qt.py +++ b/plugins/ledger/qt.py @@ -20,7 +20,6 @@ class Plugin(LedgerPlugin, QtPluginBase): @hook def receive_menu(self, menu, addrs, wallet): - print('receive_menu') if type(wallet) is not Standard_Wallet: return keystore = wallet.get_keystore()