This commit is contained in:
scgbckbone 2025-10-30 13:16:10 +01:00
parent 3f938c31e1
commit 203c288de8
4 changed files with 11 additions and 4 deletions

View File

@ -828,6 +828,9 @@ async def done_signing(psbt, tx_req, input_method=None, filename=None,
data_len = psram.tell()
data_sha2 = psram.checksum.digest()
# BBQR is at TMP_OUTPUT_OFFSET + 1MB - allowing it in this case would overwrite txn
allow_qr = data_len < (1024*1024)
if input_method == "usb":
# return result over USB before going to all options
tx_req.result = data_len, data_sha2
@ -855,7 +858,8 @@ async def done_signing(psbt, tx_req, input_method=None, filename=None,
if first_time:
# first time, assume they want to send out same way it came in -- don't prompt
if input_method == "qr":
ch = KEY_QR
if allow_qr:
ch = KEY_QR
elif input_method == "nfc":
ch = KEY_NFC
elif input_method == "kt":
@ -878,7 +882,7 @@ async def done_signing(psbt, tx_req, input_method=None, filename=None,
# files on SD infinitely (would never actually prompt).
ch = await import_export_prompt(noun, intro="\n\n".join(intro), offer_kt=offer_kt,
txid=txid, title=title, force_prompt=not first_time,
no_qr=not version.has_qwerty)
no_qr=not version.has_qwerty or not allow_qr)
if ch == KEY_CANCEL:
UserAuthorizedAction.cleanup()
break

View File

@ -1207,7 +1207,7 @@ async def show_bbqr_codes(type_code, data, msg, already_hex=False):
from ux import ux_wait_keydown
import uqr
# put QR shenanigans at unused offset 1MB after TXN_OUTPUT_OFFSET
# put QR shenanigans at offset 1MB after TXN_OUTPUT_OFFSET
TMP_OFFSET = const(3 * 1024 * 1024)
assert not PSRAM.is_at(data, TMP_OFFSET) # output data would be overwritten with our work

View File

@ -438,6 +438,8 @@ def test_big_guys(microsd_path, src_root_dir, goto_home, pick_menu_item, need_ke
enter_complex(32*"a", apply=False, b39pass=False)
time.sleep(.5)
press_select()
time.sleep(.1)
press_select()
with open(microsd_path(fname.split(".")[0]+".psbt"), "w") as f:
f.write(psbt)

View File

@ -213,7 +213,8 @@ def test_io_size(request, use_regtest, decode_with_bitcoind, fake_txn,
num_in = 250
num_out = 2000
psbt = fake_txn(num_in, num_out, dev.master_xpub, addr_fmt=addr_fmt)
psbt = fake_txn(num_in, num_out, dev.master_xpub, addr_fmt=addr_fmt,
force_full_tx_utxo=True, supply_num_ins=10, supply_num_outs=10)
with open(f'{sim_root_dir}/debug/last.psbt', 'wb') as f:
f.write(psbt)