tMerge pull request #858 from btchip/labelfix - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 10aba39d4e11b595776794f32ef13af5c13e5069 DIR parent 38fb26f1e806c169839a9d7000c57ea3d86278a5 HTML Author: ThomasV <thomasv1@gmx.de> Date: Sun, 21 Sep 2014 19:23:34 +0200 Merge pull request #858 from btchip/labelfix Fix behavior when calling get_master_public_key from an external context Diffstat: M plugins/btchipwallet.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- DIR diff --git a/plugins/btchipwallet.py b/plugins/btchipwallet.py t@@ -113,8 +113,9 @@ class BTChipWallet(NewWallet): QMessageBox.warning(QDialog(), _('Warning'), _(message), _('OK')) else: self.signing = False - if clear_client: + if clear_client and self.client is not None: self.client.bad = True + self.device_checked = False raise Exception(message) def get_action(self): t@@ -254,9 +255,15 @@ class BTChipWallet(NewWallet): return EncodeBase58Check(xpub) def get_master_public_key(self): - if not self.mpk: - self.mpk = self.get_public_key("44'/0'") - return self.mpk + try: + if not self.mpk: + self.get_client() # prompt for the PIN if necessary + if not self.check_proper_device(): + self.give_error('Wrong device or password') + self.mpk = self.get_public_key("44'/0'") + return self.mpk + except Exception, e: + self.give_error(e, True) def i4b(self, x): return pack('>I', x) t@@ -286,6 +293,7 @@ class BTChipWallet(NewWallet): raise Exception('Aborted by user') pin = pin.encode() self.client.bad = True + self.device_checked = False self.get_client(True) signature = self.get_client().signMessageSign(pin) except Exception, e: t@@ -384,6 +392,7 @@ class BTChipWallet(NewWallet): raise Exception('Aborted by user') pin = pin.encode() self.client.bad = True + self.device_checked = False self.get_client(True) waitDialog.start("Signing ...") else: