electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit e994736bf5b7c3d2afaa3faa7e614280bb3b36c1
parent 1427d962499ff1f8dca56b3474a1e0173b211524
Author: ThomasV <thomasv@gitorious>
Date:   Sun, 28 Jun 2015 21:55:01 +0200

trezor: print more info, in order to fix issue #1306

Diffstat:
Mplugins/trezor.py | 27+++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/plugins/trezor.py b/plugins/trezor.py @@ -80,18 +80,13 @@ class Plugin(BasePlugin): def compare_version(self, major, minor=0, patch=0): features = self.get_client().features - return cmp([features.major_version, features.minor_version, features.patch_version], [major, minor, patch]) + v = [features.major_version, features.minor_version, features.patch_version] + self.print_error('firmware version', v) + return cmp(v, [major, minor, patch]) def atleast_version(self, major, minor=0, patch=0): return self.compare_version(major, minor, patch) >= 0 - def trezor_is_connected(self): - try: - self.get_client().ping('t') - except: - return False - return True - def get_client(self): if not TREZOR: give_error('please install github.com/trezor/python-trezor') @@ -106,6 +101,7 @@ class Plugin(BasePlugin): self.client.set_tx_api(self) self.client.bad = False if not self.atleast_version(1, 2, 1): + self.client = None give_error('Outdated Trezor firmware. Please update the firmware from https://www.mytrezor.com') return self.client @@ -135,12 +131,15 @@ class Plugin(BasePlugin): if self.handler is None: self.handler = TrezorQtHandler(self.window.app) - if self.trezor_is_connected(): - if self.wallet.addresses() and not self.wallet.check_proper_device(): - QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK')) - self.wallet.force_watching_only = True - else: - QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode."), _('OK')) + try: + self.get_client().ping('t') + except BaseException as e: + QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode." + '\n\nReason:\n' + str(e)), _('OK')) + self.wallet.force_watching_only = True + return + + if self.wallet.addresses() and not self.wallet.check_proper_device(): + QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK')) self.wallet.force_watching_only = True @hook