electrum

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

commit 84239e168be365434cfed4e22335b47890eca97c
parent 414b6e8a06f379e67ee85fe00cc6e9239c5020e2
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon,  4 Dec 2017 19:56:46 +0100

trezor/keepkey separation: init device

Diffstat:
Mplugins/keepkey/plugin.py | 16++--------------
Mplugins/trezor/plugin.py | 15++++++++-------
2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/plugins/keepkey/plugin.py b/plugins/keepkey/plugin.py @@ -169,26 +169,14 @@ class KeepKeyCompatiblePlugin(HW_PluginBase): def _initialize_device(self, settings, method, device_id, wizard, handler): item, label, pin_protection, passphrase_protection = settings - if method == TIM_RECOVER and self.device == 'TREZOR': - # Warn user about firmware lameness - handler.show_error(_( - "You will be asked to enter 24 words regardless of your " - "seed's actual length. If you enter a word incorrectly or " - "misspell it, you cannot change it or go back - you will need " - "to start again from the beginning.\n\nSo please enter " - "the words carefully!")) - language = 'english' devmgr = self.device_manager() client = devmgr.client_by_id(device_id) if method == TIM_NEW: strength = 64 * (item + 2) # 128, 192 or 256 - args = [True, strength, passphrase_protection, - pin_protection, label, language] - if self.device == 'TREZOR': - args.extend([0, False]) # u2f_counter, skip_backup - client.reset_device(*args) + client.reset_device(True, strength, passphrase_protection, + pin_protection, label, language) elif method == TIM_RECOVER: word_count = 6 * (item + 2) # 12, 18 or 24 client.step = 0 diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py @@ -168,8 +168,9 @@ class TrezorCompatiblePlugin(HW_PluginBase): def _initialize_device(self, settings, method, device_id, wizard, handler): item, label, pin_protection, passphrase_protection = settings - if method == TIM_RECOVER and self.device == 'TREZOR': - # Warn user about firmware lameness + if method == TIM_RECOVER: + # FIXME the PIN prompt will appear over this message + # which makes this unreadable handler.show_error(_( "You will be asked to enter 24 words regardless of your " "seed's actual length. If you enter a word incorrectly or " @@ -183,11 +184,11 @@ class TrezorCompatiblePlugin(HW_PluginBase): if method == TIM_NEW: strength = 64 * (item + 2) # 128, 192 or 256 - args = [True, strength, passphrase_protection, - pin_protection, label, language] - if self.device == 'TREZOR': - args.extend([0, False]) # u2f_counter, skip_backup - client.reset_device(*args) + u2f_counter = 0 + skip_backup = False + client.reset_device(True, strength, passphrase_protection, + pin_protection, label, language, + u2f_counter, skip_backup) elif method == TIM_RECOVER: word_count = 6 * (item + 2) # 12, 18 or 24 client.step = 0