tMerge pull request #3370 from benma/devices - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 24af61816414927392142ec6f28e7c7e859b500f DIR parent f4650a199a4cd92c628ca6b3480ea108fbab5850 HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 24 Nov 2017 10:24:47 +0100 Merge pull request #3370 from benma/devices digitalbitbox: correctly handle user aborts Diffstat: M lib/plugins.py | 2 +- M plugins/digitalbitbox/digitalbitbo… | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -472,7 +472,7 @@ class DeviceMgr(ThreadJob, PrintError): infos = self.unpaired_device_infos(handler, plugin, devices) if infos: break - msg = _('Could not connect to your %s. Verify the cable is ' + msg = _('Please insert your %s. Verify the cable is ' 'connected and that no other application is using it.\n\n' 'Try to connect again?') % plugin.device if not handler.yes_no_question(msg): DIR diff --git a/plugins/digitalbitbox/digitalbitbox.py b/plugins/digitalbitbox/digitalbitbox.py t@@ -11,7 +11,7 @@ try: from electrum.i18n import _ from electrum.keystore import Hardware_KeyStore from ..hw_wallet import HW_PluginBase - from electrum.util import print_error, to_string + from electrum.util import print_error, to_string, UserCancelled import time import hid t@@ -588,6 +588,9 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore): self.handler.finished() if 'error' in reply: + if reply["error"].get('code') in (600, 601): + # aborted via LED short touch or timeout + raise UserCancelled() raise Exception(reply['error']['message']) if 'sign' not in reply: t@@ -623,6 +626,8 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore): sig = sigencode_der(sig_r, sig_s, generator_secp256k1.order()) txin['signatures'][ii] = to_hexstr(sig) + '01' tx._inputs[i] = txin + except UserCancelled: + raise except BaseException as e: self.give_error(e, True) else: