Skip to content

BIP370: add Input Finalizer section; BIP371: remove finalizer clause from an output field - #2277

Merged
jonatack merged 2 commits into
bitcoin:masterfrom
fametrano:psbt-finalizer-clearing
Sep 23, 2026
Merged

jonatack merged 2 commits into
bitcoin:masterfrom
fametrano:psbt-finalizer-clearing

Conversation

@fametrano

@fametrano fametrano commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Two independent commits.

BIP370: add an Input Finalizer section

In a version 2 PSBT, the fields that define an input live in the input map: PSBT_IN_PREVIOUS_TXID, PSBT_IN_OUTPUT_INDEX, PSBT_IN_SEQUENCE, and the two required-locktime fields.

BIP174 tells the Input Finalizer to clear every field of a finalized input except the UTXO and unknown fields. Followed literally on a version 2 input, this deletes the fields above. Without PSBT_IN_PREVIOUS_TXID or PSBT_IN_OUTPUT_INDEX the PSBT is invalid; without the sequence and locktime fields the Transaction Extractor builds a different transaction.

BIP370 defines every other role for version 2 but has no Input Finalizer section. This adds one, stating that the finalizer keeps those five fields. Bitcoin Core already does this: its input serializer writes them whether or not the input is finalized.

BIP371: remove a finalizer clause from an output field

PSBT_OUT_TAP_BIP32_DERIVATION carries the note "Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed".

This is an output field. An output has no PSBT_IN_FINAL_SCRIPTWITNESS, and the clause names no input to act on. The two neighbouring output fields carry no such note. This removes it.

Both are minor amendments to Deployed BIPs.

@fametrano fametrano changed the title BIP370: add the Input Finalizer role; BIP371: drop the finalizer clause from PSBT_OUT_TAP_BIP32_DERIVATION BIP370: add Input Finalizer section; BIP371: remove finalizer clause from an output field Sep 7, 2026
@murchandamus murchandamus added Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Sep 9, 2026
@fametrano
fametrano force-pushed the psbt-finalizer-clearing branch from f5034ac to 5bd6a7a Compare September 12, 2026 12:35
@fametrano
fametrano force-pushed the psbt-finalizer-clearing branch from 5bd6a7a to e2ac6a5 Compare September 19, 2026 13:06
BIP 174 tells the Input Finalizer to clear all other data except the
UTXO and unknown fields from a finalized input. It was written when the
unsigned transaction was a global field. PSBTv2 moves the data that
defines the input into the input map, and a finalizer that follows the
sentence literally removes it: without PSBT_IN_PREVIOUS_TXID or
PSBT_IN_OUTPUT_INDEX the result is invalid, and without
PSBT_IN_SEQUENCE and the locktime fields the Transaction Extractor
builds a different transaction.

BIP 370 amends Creator, Updater, Signer and Transaction Extractor for
PSBTv2, adds the Constructor, and says nothing about the Input
Finalizer. Add the section: the five fields are kept. Bitcoin Core
does this today: at 19b0ff2fa0, PSBTInput::Serialize in src/psbt.h
writes them for every PSBTv2 input, finalized or not.
The six taproot input fields say "Finalizers should remove this field
after PSBT_IN_FINAL_SCRIPTWITNESS is constructed", and so does the
output field PSBT_OUT_TAP_BIP32_DERIVATION. An output has no
PSBT_IN_FINAL_SCRIPTWITNESS, the clause names no input, and its two
neighbours in the output table carry no such clause. Drop it; Bitcoin
Core does not clear output fields on finalization.
@fametrano
fametrano force-pushed the psbt-finalizer-clearing branch from e2ac6a5 to 8629462 Compare September 23, 2026 21:02
@achow101

Copy link
Copy Markdown
Member

ACK 8629462

@jonatack jonatack removed the Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified label Sep 23, 2026
@jonatack
jonatack merged commit e8987d3 into bitcoin:master Sep 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Proposed BIP modification PR by non-owner to update BIP content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants