From 7ddc8439a0558c9d9e63fdadbbbc713fc3c27378 Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Wed, 19 Jul 2023 19:51:21 -0500 Subject: [PATCH] SFT-2235: added error handling to showing the signed QR --- .../Passport/modules/flows/sign_psbt_qr_flow.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py index 228d32317..94b019641 100644 --- a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py @@ -137,7 +137,7 @@ async def get_signed_bytes(self): self.goto(self.show_signed_transaction) async def show_signed_transaction(self): - from pages import ShowQRPage + from pages import ShowQRPage, ErrorPage from data_codecs.qr_type import QRType from ubinascii import hexlify as b2a_hex import microns @@ -155,10 +155,16 @@ async def show_signed_transaction(self): else: raise RuntimeError('Unknown UR type: {}'.format(self.ur_type)) - result = await ShowQRPage(qr_type=qr_type, - qr_data=qr_data, - left_micron=microns.MicroSD, - right_micron=microns.Checkmark).show() + result = False + try: + result = await ShowQRPage(qr_type=qr_type, + qr_data=qr_data, + left_micron=microns.MicroSD, + right_micron=microns.Checkmark).show() + except MemoryError as e: + await ErrorPage(text='Transaction is too complex: {}'.format(e)).show() + self.set_result(False) + return if not result: self.goto(self.save_to_microsd)