Don't send Initialize when first connecting to a Trezor
Instead of sending Initialize, don't. This lets it stay in the same "session" as previous commands so some state such as passphrases are still cached by the device. If GetFeatures fails, then try sending Initialize so that any inconsistent state on the device is cleared.
This commit is contained in:
parent
6e92b7d40f
commit
d00ae56eef
@ -178,7 +178,10 @@ class TrezorClient:
|
||||
|
||||
@tools.session
|
||||
def init_device(self):
|
||||
resp = self.call_raw(messages.Initialize(state=self.state))
|
||||
resp = self.call_raw(messages.GetFeatures())
|
||||
# If GetFeatures fails, try initializing and clearing inconsistent state on the device
|
||||
if isinstance(resp, messages.Failure):
|
||||
resp = self.call_raw(messages.Initialize())
|
||||
if not isinstance(resp, messages.Features):
|
||||
raise exceptions.TrezorException("Unexpected initial response")
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user