From 034b0a03130138db53661de29cdac0a66a499f12 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 1 May 2018 22:49:43 +0200 Subject: [PATCH] trezor/keepkey: silence UserCancelled during recovery --- plugins/keepkey/keepkey.py | 4 +++- plugins/trezor/trezor.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/keepkey/keepkey.py b/plugins/keepkey/keepkey.py index 0013b42f5..56c817668 100644 --- a/plugins/keepkey/keepkey.py +++ b/plugins/keepkey/keepkey.py @@ -2,7 +2,7 @@ from binascii import hexlify, unhexlify import traceback 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, TYPE_ADDRESS, TYPE_SCRIPT, is_segwit_address) @@ -186,6 +186,8 @@ class KeepKeyPlugin(HW_PluginBase): def _initialize_device_safe(self, settings, method, device_id, wizard, handler): try: self._initialize_device(settings, method, device_id, wizard, handler) + except UserCancelled: + pass except BaseException as e: traceback.print_exc(file=sys.stderr) handler.show_error(str(e)) diff --git a/plugins/trezor/trezor.py b/plugins/trezor/trezor.py index aa49ace90..3539b9de4 100644 --- a/plugins/trezor/trezor.py +++ b/plugins/trezor/trezor.py @@ -2,7 +2,7 @@ from binascii import hexlify, unhexlify import traceback 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, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum import constants @@ -207,6 +207,8 @@ class TrezorPlugin(HW_PluginBase): def _initialize_device_safe(self, settings, method, device_id, wizard, handler): try: self._initialize_device(settings, method, device_id, wizard, handler) + except UserCancelled: + pass except BaseException as e: traceback.print_exc(file=sys.stderr) handler.show_error(str(e))