trezor: print more info, in order to fix issue #1306
This commit is contained in:
parent
1427d96249
commit
e994736bf5
|
@ -80,18 +80,13 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
def compare_version(self, major, minor=0, patch=0):
|
def compare_version(self, major, minor=0, patch=0):
|
||||||
features = self.get_client().features
|
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):
|
def atleast_version(self, major, minor=0, patch=0):
|
||||||
return self.compare_version(major, minor, 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):
|
def get_client(self):
|
||||||
if not TREZOR:
|
if not TREZOR:
|
||||||
give_error('please install github.com/trezor/python-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.set_tx_api(self)
|
||||||
self.client.bad = False
|
self.client.bad = False
|
||||||
if not self.atleast_version(1, 2, 1):
|
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')
|
give_error('Outdated Trezor firmware. Please update the firmware from https://www.mytrezor.com')
|
||||||
return self.client
|
return self.client
|
||||||
|
|
||||||
|
@ -135,12 +131,15 @@ class Plugin(BasePlugin):
|
||||||
if self.handler is None:
|
if self.handler is None:
|
||||||
self.handler = TrezorQtHandler(self.window.app)
|
self.handler = TrezorQtHandler(self.window.app)
|
||||||
|
|
||||||
if self.trezor_is_connected():
|
try:
|
||||||
if self.wallet.addresses() and not self.wallet.check_proper_device():
|
self.get_client().ping('t')
|
||||||
QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK'))
|
except BaseException as e:
|
||||||
self.wallet.force_watching_only = True
|
QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode." + '\n\nReason:\n' + str(e)), _('OK'))
|
||||||
else:
|
self.wallet.force_watching_only = True
|
||||||
QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode."), _('OK'))
|
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
|
self.wallet.force_watching_only = True
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
|
|
Loading…
Reference in New Issue