1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-01 20:32:35 +00:00

fix(core): scope Cardano confirmation to allow GC

Otherwise, we may run out of heap due to recursion.

[no changelog]
This commit is contained in:
Roman Zeyde 2025-03-09 13:59:59 +02:00 committed by Roman Zeyde
parent 103568e2e5
commit 2400fcb95d

View File

@ -89,9 +89,11 @@ async def show_native_script(
key_hash = script.key_hash # local_cache_attribute key_hash = script.key_hash # local_cache_attribute
scripts = script.scripts # local_cache_attribute scripts = script.scripts # local_cache_attribute
script_heading = "Script"
if indices is None: if indices is None:
indices = [] indices = []
async def confirm_native_script() -> None:
script_heading = "Script"
if indices: if indices:
script_heading += " " + ".".join(str(i) for i in indices) script_heading += " " + ".".join(str(i) for i in indices)
@ -148,6 +150,9 @@ async def show_native_script(
br_code=BRT_Other, br_code=BRT_Other,
) )
# Allow GC to free local variables after confirmation is over
await confirm_native_script()
for i, sub_script in enumerate(scripts): for i, sub_script in enumerate(scripts):
await show_native_script(sub_script, indices + [i + 1]) await show_native_script(sub_script, indices + [i + 1])