electrum

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

commit d5db18c59419cf7bc19f2e2a822a063232199030
parent fe2fdfe400593ca57522df89ee589e7c1b4427e8
Author: ThomasV <thomasv@electrum.org>
Date:   Mon,  8 Feb 2016 11:07:02 +0100

Merge branch 'master' of git://github.com/spesmilo/electrum

Diffstat:
Mgui/qt/main_window.py | 3---
Mlib/plugins.py | 14+++++++++++---
Mplugins/hw_wallet/hw_wallet.py | 13+++----------
Mplugins/hw_wallet/qt.py | 3---
Mplugins/ledger/ledger.py | 1-
Mplugins/trezor/plugin.py | 7+------
6 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -154,9 +154,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): self.connect(self, QtCore.SIGNAL('payment_request_error'), self.payment_request_error) self.history_list.setFocus(True) - self.connect(self, QtCore.SIGNAL('watching_only_changed'), - self.watching_only_changed) - # network callbacks if self.network: self.connect(self, QtCore.SIGNAL('network'), self.on_network_qt) diff --git a/lib/plugins.py b/lib/plugins.py @@ -392,14 +392,22 @@ class DeviceMgr(PrintError): # See comment above for same code client.handler = wallet.handler # This will trigger a PIN/passphrase entry request - client_first_address = client.first_address(derivation) + try: + client_first_address = client.first_address(derivation) + except (UserCancelled, RuntimeError): + # Bad / cancelled PIN / passphrase + client_first_address = None if client_first_address == first_address: self.pair_wallet(wallet, info.device.id_) return client - # The user input has wrong PIN or passphrase, or it is not pairable + # The user input has wrong PIN or passphrase, or cancelled input, + # or it is not pairable raise DeviceUnpairableError( - _('Unable to pair with your %s.') % plugin.device) + _('Unable to pair with your %s.\n\n' + 'Ensure you are able to pair it, or you have the seed phrase, ' + 'before you request bitcoins to be sent to this wallet.' + ) % plugin.device) def unpaired_device_infos(self, handler, plugin, devices=None): '''Returns a list of DeviceInfo objects: one for each connected, diff --git a/plugins/hw_wallet/hw_wallet.py b/plugins/hw_wallet/hw_wallet.py @@ -39,29 +39,21 @@ class BIP44_HW_Wallet(BIP44_Wallet): # handler. The handler is per-window and preserved across # device reconnects self.handler = None - self.force_watching_only = False def set_session_timeout(self, seconds): self.print_error("setting session timeout to %d seconds" % seconds) self.session_timeout = seconds self.storage.put('session_timeout', seconds) - def set_force_watching_only(self, value): - if value != self.force_watching_only: - self.force_watching_only = value - self.handler.watching_only_changed() - def unpaired(self): '''A device paired with the wallet was diconnected. This can be called in any thread context.''' self.print_error("unpaired") - self.set_force_watching_only(True) def paired(self): '''A device paired with the wallet was (re-)connected. This can be called in any thread context.''' self.print_error("paired") - self.set_force_watching_only(False) def timeout(self): '''Called when the wallet session times out. Note this is called from @@ -81,9 +73,10 @@ class BIP44_HW_Wallet(BIP44_Wallet): return False def is_watching_only(self): - '''The wallet is watching-only if its trezor device is unpaired.''' + '''The wallet is not watching-only; the user will be prompted for + pin and passphrase as appropriate when needed.''' assert not self.has_seed() - return self.force_watching_only + return False def can_change_password(self): return False diff --git a/plugins/hw_wallet/qt.py b/plugins/hw_wallet/qt.py @@ -53,9 +53,6 @@ class QtHandlerBase(QObject, PrintError): def top_level_window(self): return self.win.top_level_window() - def watching_only_changed(self): - self.win.emit(SIGNAL('watching_only_changed')) - def query_choice(self, msg, labels): self.done.clear() self.qcSig.emit(msg, labels) diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py @@ -37,7 +37,6 @@ class BTChipWallet(BIP44_HW_Wallet): # device reconnects self.handler = None self.force_watching_only = False - self.device_checked = False self.signing = False diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py @@ -134,12 +134,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): assert self.main_thread != threading.current_thread() devmgr = self.device_manager() - try: - client = devmgr.client_for_wallet(self, wallet, force_pair) - except: - wallet.set_force_watching_only(True) - raise - + client = devmgr.client_for_wallet(self, wallet, force_pair) if client: self.print_error("set last_operation") wallet.last_operation = time.time()