Skip to content

Commit

Permalink
SFT-2454: added MemoryError handling for saving to microSD
Browse files Browse the repository at this point in the history
  • Loading branch information
mjg-foundation committed Jul 19, 2023
1 parent 838ab76 commit 0c3e850
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,18 @@ async def save_to_microsd(self):
# Add -signed to end. We won't offer to sign again.
target_fname = base + '-signed.psbt'

self.filename = await SaveToMicroSDFlow(filename=target_fname,
data=b2a_hex(self.signed_bytes),
success_text="psbt",
path=get_folder_path(DIR_TRANSACTIONS),
automatic=False,
auto_prompt=True).run()
try:
self.filename = await SaveToMicroSDFlow(filename=target_fname,
data=b2a_hex(self.signed_bytes),
success_text="psbt",
path=get_folder_path(DIR_TRANSACTIONS),
automatic=False,
auto_prompt=True).run()
except MemoryError as e:
await ErrorPage(text='Transaction is too complex: {}'.format(e)).show()
self.set_result(False)
return

if self.filename is None:
self.back()
return
Expand Down

0 comments on commit 0c3e850

Please sign in to comment.