Browse Source

trezor/keepkey: silence UserCancelled during recovery

3.2.x
SomberNight 7 years ago
parent
commit
034b0a0313
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      plugins/keepkey/keepkey.py
  2. 4
      plugins/trezor/trezor.py

4
plugins/keepkey/keepkey.py

@ -2,7 +2,7 @@ from binascii import hexlify, unhexlify
import traceback import traceback
import sys import sys
from electrum.util import bfh, bh2u from electrum.util import bfh, bh2u, UserCancelled
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address) is_segwit_address)
@ -186,6 +186,8 @@ class KeepKeyPlugin(HW_PluginBase):
def _initialize_device_safe(self, settings, method, device_id, wizard, handler): def _initialize_device_safe(self, settings, method, device_id, wizard, handler):
try: try:
self._initialize_device(settings, method, device_id, wizard, handler) self._initialize_device(settings, method, device_id, wizard, handler)
except UserCancelled:
pass
except BaseException as e: except BaseException as e:
traceback.print_exc(file=sys.stderr) traceback.print_exc(file=sys.stderr)
handler.show_error(str(e)) handler.show_error(str(e))

4
plugins/trezor/trezor.py

@ -2,7 +2,7 @@ from binascii import hexlify, unhexlify
import traceback import traceback
import sys import sys
from electrum.util import bfh, bh2u, versiontuple from electrum.util import bfh, bh2u, versiontuple, UserCancelled
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, is_address) TYPE_ADDRESS, TYPE_SCRIPT, is_address)
from electrum import constants from electrum import constants
@ -207,6 +207,8 @@ class TrezorPlugin(HW_PluginBase):
def _initialize_device_safe(self, settings, method, device_id, wizard, handler): def _initialize_device_safe(self, settings, method, device_id, wizard, handler):
try: try:
self._initialize_device(settings, method, device_id, wizard, handler) self._initialize_device(settings, method, device_id, wizard, handler)
except UserCancelled:
pass
except BaseException as e: except BaseException as e:
traceback.print_exc(file=sys.stderr) traceback.print_exc(file=sys.stderr)
handler.show_error(str(e)) handler.show_error(str(e))

Loading…
Cancel
Save