bugfix: do not offer to show QR code of TXID if txn is not finalized

This commit is contained in:
scgbckbone 2026-03-04 19:42:11 +01:00 committed by doc-hex
parent e92a8ccde1
commit c19be4f41e
2 changed files with 20 additions and 2 deletions

View File

@ -861,9 +861,11 @@ async def done_signing(psbt, tx_req, input_method=None, filename=None,
if not ch:
# show all possible export options (based on hardware enabled, features)
intro = []
key6 = None
if msg:
intro.append(msg)
if txid:
key6 = "for QR Code of TXID"
intro.append('TXID:\n' + txid)
# "force_prompt" is needed after first iteration as we can be Mk4, with NFC,Vdisk off,
@ -871,8 +873,7 @@ async def done_signing(psbt, tx_req, input_method=None, filename=None,
# In that case this would just return dict and keep producing signed
# files on SD infinitely (would never actually prompt).
ch = await import_export_prompt(noun, intro="\n\n".join(intro), offer_kt=offer_kt,
key6="for QR Code of TXID", title=title,
force_prompt=not first_time,
key6=key6, title=title, force_prompt=not first_time,
no_qr=not version.has_qwerty)
if ch == KEY_CANCEL:
UserAuthorizedAction.cleanup()

View File

@ -3657,4 +3657,21 @@ def test_duplicate_inputs(segwit_in, num_ins, fake_txn, start_sign, end_sign, ca
else:
assert title == "OK TO SEND?"
def test_txid_qr(fake_txn, start_sign, cap_story, press_cancel, press_select):
psbt = fake_txn(1, 2, change_outputs=[0])
start_sign(psbt, finalize=False)
press_select() # confirm signing
time.sleep(.1)
title, story = cap_story()
assert "(6) for QR Code of TXID" not in story
press_cancel() # refuse
time.sleep(.1)
start_sign(psbt, finalize=True)
press_select() # confirm signing
time.sleep(.1)
title, story = cap_story()
assert "(6) for QR Code of TXID" in story
press_cancel()
# EOF