commit d8a9c9720a6a21928e8b8852bef02d356e664093
parent 65eae139af5d827ccafc85c2a9e5d0088411ed01
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 10 Jan 2018 18:39:25 +0100
follow-up 65eae139af5d827ccafc85c2a9e5d0088411ed01
Diffstat:
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git 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
@@ -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
@@ -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()