mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 07:54:42 +00:00
qml: Render OP_RETURN outputs in imported PSBT review #769
No reviewers
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml!769
Loading…
Reference in a new issue
No description provided.
Delete branch "show-op-return-outputs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
dataoutput 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
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
SendRecipientmodel 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.SendRecipientgainsisDataOutput/dataHex. Data outputs always report valid, so they never block the flow.SendRecipientsListModelexposes 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.MultipleRecipientsSummaryrenders data rows read-only ("Data output" + script hex).SingleRecipientSummaryis 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
importPsbtFromFile_skipsZeroValueOpReturnOutputsasimportPsbtFromFile_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)
Please rebase.
Concept ACK.
Rebased
2baa7f9cfontobc4f688. The QML commit,3c7493c5f, conflicts in MultipleRecipientsSummary.qml with1a7c480and3678c40from #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.This clears the
isValid()gate, thenallValid()/validationError()stillDecodeDestination()the empty address. Two data outputs collide asCNoDestinationand fail withRecipient addresses must be unique. Skip data outputs in those checks.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?
This is the full script, so the row shows
6a020102(opcode and push length) rather than the payload0102. The new test asserts6a020102, which pins that. Is showing the whole script deliberate, or should the row show the payload?