From 0d76936174ce5d414a20c160d7dff343971549a6 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 21 Jun 2017 17:29:49 +0300 Subject: [PATCH] Allow testing recovery with an initialized device --- trezorctl | 3 ++- trezorlib/client.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/trezorctl b/trezorctl index 32f784589f..0a35df5c4a 100755 --- a/trezorctl +++ b/trezorctl @@ -277,7 +277,7 @@ class Commands(object): 'matrix': types.RecoveryDeviceType_Matrix } return self.client.recovery_device(args.words, args.passphrase_protection, args.pin_protection, args.label, 'english', - typemap[args.type], args.expand) + typemap[args.type], args.expand, args.dry_run) def load_device(self, args): if not args.mnemonic and not args.xprv: @@ -474,6 +474,7 @@ class Commands(object): (('-r', '--passphrase-protection'), {'action': 'store_true', 'default': False}), (('-l', '--label'), {'type': str, 'default': ''}), (('-t', '--type'), {'type': str, 'choices': ['scrambled', 'matrix'], 'default': 'scrambled'}), + (('-d', '--dry-run'), {'action': 'store_true', 'default': False}), ) load_device.arguments = ( diff --git a/trezorlib/client.py b/trezorlib/client.py index 7b25833b60..0ee835b0c3 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -830,8 +830,8 @@ class ProtocolMixin(object): @field('message') @expect(proto.Success) - def recovery_device(self, word_count, passphrase_protection, pin_protection, label, language, type=types.RecoveryDeviceType_ScrambledWords, expand=False): - if self.features.initialized: + def recovery_device(self, word_count, passphrase_protection, pin_protection, label, language, type=types.RecoveryDeviceType_ScrambledWords, expand=False, dry_run=False): + if self.features.initialized and not dry_run: raise Exception("Device is initialized already. Call wipe_device() and try again.") if word_count not in (12, 18, 24): @@ -850,7 +850,8 @@ class ProtocolMixin(object): label=label, language=language, enforce_wordlist=True, - type=type)) + type=type, + dry_run=dry_run)) self.init_device() return res