diff --git a/core/.changelog.d/4537.fixed b/core/.changelog.d/4537.fixed new file mode 100644 index 0000000000..e3ce204e6a --- /dev/null +++ b/core/.changelog.d/4537.fixed @@ -0,0 +1 @@ +[T2T1] Fixed a bug resulting in restarting the recovery flow when inputting 33-word mnemonic. diff --git a/core/src/trezor/ui/layouts/bolt/recovery.py b/core/src/trezor/ui/layouts/bolt/recovery.py index a2528c6082..614b35f135 100644 --- a/core/src/trezor/ui/layouts/bolt/recovery.py +++ b/core/src/trezor/ui/layouts/bolt/recovery.py @@ -32,21 +32,24 @@ async def request_word( ) -> str: prompt = TR.recovery__type_word_x_of_y_template.format(word_index + 1, word_count) can_go_back = word_index > 0 + if is_slip39: keyboard = trezorui_api.request_slip39( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back ) - else: keyboard = trezorui_api.request_bip39( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back ) - word: str = await interact( - keyboard, - "mnemonic" if send_button_request else None, - ButtonRequestType.MnemonicInput, - ) + try: + word: str = await interact( + keyboard, + "mnemonic" if send_button_request else None, + ButtonRequestType.MnemonicInput, + ) + finally: + keyboard.__del__() return word diff --git a/core/src/trezor/ui/layouts/caesar/recovery.py b/core/src/trezor/ui/layouts/caesar/recovery.py index 4ab3dd33e3..36b4505781 100644 --- a/core/src/trezor/ui/layouts/caesar/recovery.py +++ b/core/src/trezor/ui/layouts/caesar/recovery.py @@ -31,24 +31,25 @@ async def request_word( prefill_word: str = "", ) -> str: prompt = TR.recovery__word_x_of_y_template.format(word_index + 1, word_count) - can_go_back = word_index > 0 if is_slip39: keyboard = trezorui_api.request_slip39( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back ) - else: keyboard = trezorui_api.request_bip39( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back ) - word: str = await interact( - keyboard, - "mnemonic" if send_button_request else None, - ButtonRequestType.MnemonicInput, - ) + try: + word: str = await interact( + keyboard, + "mnemonic" if send_button_request else None, + ButtonRequestType.MnemonicInput, + ) + finally: + keyboard.__del__() return word diff --git a/core/src/trezor/ui/layouts/delizia/recovery.py b/core/src/trezor/ui/layouts/delizia/recovery.py index 1f2ddfa267..82019bff4d 100644 --- a/core/src/trezor/ui/layouts/delizia/recovery.py +++ b/core/src/trezor/ui/layouts/delizia/recovery.py @@ -33,6 +33,7 @@ async def request_word( ) -> str: prompt = TR.recovery__word_x_of_y_template.format(word_index + 1, word_count) can_go_back = word_index > 0 + if is_slip39: keyboard = trezorui_api.request_slip39( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back @@ -42,11 +43,14 @@ async def request_word( prompt=prompt, prefill_word=prefill_word, can_go_back=can_go_back ) - word: str = await interact( - keyboard, - "mnemonic" if send_button_request else None, - ButtonRequestType.MnemonicInput, - ) + try: + word: str = await interact( + keyboard, + "mnemonic" if send_button_request else None, + ButtonRequestType.MnemonicInput, + ) + finally: + keyboard.__del__() return word