qml: Render OP_RETURN outputs in imported PSBT review #769

Open
Chigala wants to merge 4 commits from show-op-return-outputs into qt6 AGit
Chigala commented 2026-07-06 09:07:00 +00:00 (Migrated from github.com)

Fixes #756. Follow-up to #750.

While learning the imported PSBT flow I reproduced the OP_RETURN skip on regtest: a PSBT with a recipient plus a data output imports fine, signs, broadcasts, and the OP_RETURN lands on-chain, but the review screen never shows it. This implements what #756 (and the #750 review discussion) asked for: render it as a read-only "Data output" row with the amount and output script hex, so it stops being invisible "without becoming a scary failure."

screenshot

Screenshot 2026-07-05 at 15 31 48

Approach

I read through the #750 review thread before writing this, so to be upfront about the design tension: @jarolrod's comments there argue imported PSBT review should eventually stop depending on the editable SendRecipient model entirely (#757, #762). I agree, but since #750 merged with the reduced-scope recipient projection, this PR stays inside that mechanism and just fixes the OP_RETURN rendering for now.

  • SendRecipient gains isDataOutput / dataHex. Data outputs always report valid, so they never block the flow.
  • SendRecipientsListModel exposes both as roles.
  • tryImportPsbtToReview() projects zero-value unspendable outputs into data rows instead of moving past them. Since the guard only admits zero-value scripts, the positive-amount check (recipient_total) behaves exactly as before.
  • MultipleRecipientsSummary renders data rows read-only ("Data output" + script hex). SingleRecipientSummary is untouched, a lone data output implies a data-only PSBT, which is still rejected (that's #759's territory).

The state is intentionally a thin flag, so when the read-only output model (#757) / imported session state (#762) land, this rendering maps onto them one-to-one. If you'd rather I do those first and have me rebase this on top, or I build the output-row model here instead adding it to this PR, that still works.

Testing

  • Rewrote importPsbtFromFile_skipsZeroValueOpReturnOutputs as importPsbtFromFile_showsOpReturnAsDataOutput: asserts the data row's flag, script hex, zero amount and validity, and keeps the existing checks that the PSBT stays broadcastable and the saved PSBT is byte-identical to the imported one.

Things I hit but left alone (tracked elsewhere)

  • Data-only PSBTs still rejected → #759
  • Positive-value unknown scripts still rejected (rather than warn) → #760
  • Back-navigation from review exposes imported rows as editable drafts, including the data output as a blank entry → #762. it's the draft-vs-session confusion your review described.
  • Two small ones that seem unfiled — the review header counts data outputs as recipients ("There are 2 recipients."), and Activity renders OP_RETURN as a blank zero-amount row.
Fixes #756. Follow-up to #750. While learning the imported PSBT flow I reproduced the OP_RETURN skip on regtest: a PSBT with a recipient plus a `data` output imports fine, signs, broadcasts, and the OP_RETURN lands on-chain, but the review screen never shows it. This implements what #756 (and the #750 review discussion) asked for: render it as a read-only "Data output" row with the amount and output script hex, so it stops being invisible "without becoming a scary failure." ## screenshot <img width="1022" height="701" alt="Screenshot 2026-07-05 at 15 31 48" src="https://git.fish.foo/attachments/906159fe-9f6e-42e5-ac25-d0955c041c35" /> ## Approach I read through the #750 review thread before writing this, so to be upfront about the design tension: @jarolrod's comments there argue imported PSBT review should eventually stop depending on the editable `SendRecipient` model entirely (#757, #762). I agree, but since #750 merged with the reduced-scope recipient projection, this PR stays inside that mechanism and just fixes the OP_RETURN rendering for now. - `SendRecipient` gains `isDataOutput` / `dataHex`. Data outputs always report valid, so they never block the flow. - `SendRecipientsListModel` exposes both as roles. - `tryImportPsbtToReview()` projects zero-value unspendable outputs into data rows instead of moving past them. Since the guard only admits zero-value scripts, the positive-amount check (`recipient_total`) behaves exactly as before. - `MultipleRecipientsSummary` renders data rows read-only ("Data output" + script hex). `SingleRecipientSummary` is untouched, a lone data output implies a data-only PSBT, which is still rejected (that's #759's territory). The state is intentionally a thin flag, so when the read-only output model (#757) / imported session state (#762) land, this rendering maps onto them one-to-one. If you'd rather I do those first and have me rebase this on top, or I build the output-row model here instead adding it to this PR, that still works. ## Testing - Rewrote `importPsbtFromFile_skipsZeroValueOpReturnOutputs` as `importPsbtFromFile_showsOpReturnAsDataOutput`: asserts the data row's flag, script hex, zero amount and validity, and keeps the existing checks that the PSBT stays broadcastable and the saved PSBT is byte-identical to the imported one. ## Things I hit but left alone (tracked elsewhere) - Data-only PSBTs still rejected → #759 - Positive-value unknown scripts still rejected (rather than warn) → #760 - Back-navigation from review exposes imported rows as editable drafts, including the data output as a blank entry → #762. it's the draft-vs-session confusion your review described. - Two small ones that seem unfiled — the review header counts data outputs as recipients ("There are 2 recipients."), and Activity renders OP_RETURN as a blank zero-amount row.
hebasto commented 2026-09-01 15:00:17 +00:00 (Migrated from github.com)

Please rebase.

Please rebase.
151henry151 (Migrated from github.com) reviewed 2026-09-04 02:45:39 +00:00
151henry151 (Migrated from github.com) left a comment

Concept ACK.

Rebased 2baa7f9cf onto bc4f688. The QML commit, 3c7493c5f, conflicts in MultipleRecipientsSummary.qml with 1a7c480 and 3678c40 from #860. Those dropped primaryText/secondaryText and the secondary TextArea, so there is nothing left to attach the data-output row to. A naive rebase imports the OP_RETURN and renders an empty addressText at amount 0.

Concept ACK. Rebased 2baa7f9cf onto bc4f688. The QML commit, 3c7493c5f, conflicts in MultipleRecipientsSummary.qml with 1a7c480 and 3678c40 from #860. Those dropped primaryText/secondaryText and the secondary TextArea, so there is nothing left to attach the data-output row to. A naive rebase imports the OP_RETURN and renders an empty addressText at amount 0.
151henry151 (Migrated from github.com) commented 2026-09-04 02:40:38 +00:00

This clears the isValid() gate, then allValid() / validationError() still DecodeDestination() the empty address. Two data outputs collide as CNoDestination and fail with Recipient addresses must be unique. Skip data outputs in those checks.

This clears the `isValid()` gate, then `allValid()` / `validationError()` still `DecodeDestination()` the empty address. Two data outputs collide as `CNoDestination` and fail with `Recipient addresses must be unique`. Skip data outputs in those checks.
151henry151 (Migrated from github.com) commented 2026-09-04 02:44:42 +00:00

These used to continue without being added, so they did not count toward the 25-recipient cap below. Should they count now, or stay excluded?

These used to continue without being added, so they did not count toward the 25-recipient cap below. Should they count now, or stay excluded?
151henry151 (Migrated from github.com) commented 2026-09-04 02:41:48 +00:00

This is the full script, so the row shows 6a020102 (opcode and push length) rather than the payload 0102. The new test asserts 6a020102, which pins that. Is showing the whole script deliberate, or should the row show the payload?

This is the full script, so the row shows `6a020102` (opcode and push length) rather than the payload `0102`. The new test asserts `6a020102`, which pins that. Is showing the whole script deliberate, or should the row show the payload?
Sign in to join this conversation.
No description provided.