From 0a6c5504efac1328b8b765808239f3a150af48d3 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 20 Sep 2024 12:03:37 +0200 Subject: [PATCH] fix(core): fix cancel behavior in SignMessage --- .../src/trezor/ui/layouts/mercury/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/src/trezor/ui/layouts/mercury/__init__.py b/core/src/trezor/ui/layouts/mercury/__init__.py index 0605ccb0a5..791a7c8d7f 100644 --- a/core/src/trezor/ui/layouts/mercury/__init__.py +++ b/core/src/trezor/ui/layouts/mercury/__init__.py @@ -1048,23 +1048,24 @@ async def confirm_signverify( ) while True: - result = await with_info( - address_layout, info_layout, br_name, br_code=BR_CODE_OTHER - ) - if result is not CONFIRMED: + try: + await with_info(address_layout, info_layout, br_name, br_code=BR_CODE_OTHER) + except ActionCancelled: result = await interact( - trezorui2.show_mismatch(title=TR.addr_mismatch__mismatch), None + trezorui2.show_mismatch(title=TR.addr_mismatch__mismatch), + None, + raise_on_cancel=None, ) assert result in (CONFIRMED, CANCELLED) # Right button aborts action, left goes back to showing address. if result is CONFIRMED: - raise ActionCancelled + raise continue - - result = await interact(message_layout, br_name, BR_CODE_OTHER) - if result is CONFIRMED: + else: break + await interact(message_layout, br_name, BR_CODE_OTHER) + def error_popup( title: str,