1
0

Trezor/KeepKey: force watching only improvements

Only warn about watching only once given a chance to pair.
Failure to pair makes watching-only and warns.
In error message to user, distinguish between failure to connect
and failure to pair.
This commit is contained in:
Neil Booth
2016-01-31 19:36:21 +09:00
parent abaf1bc6dc
commit e61fffab55
4 changed files with 50 additions and 31 deletions

View File

@@ -39,26 +39,29 @@ class BIP44_HW_Wallet(BIP44_Wallet):
# handler. The handler is per-window and preserved across
# device reconnects
self.handler = None
self.force_watching_only = True
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.force_watching_only = True
self.handler.watching_only_changed()
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.force_watching_only = False
self.handler.watching_only_changed()
self.set_force_watching_only(False)
def timeout(self):
'''Called when the wallet session times out. Note this is called from