#36567 psbt: drop Taproot and MuSig2 signatures when adding an input
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36567 psbt: drop Taproot and MuSig2 signatures when adding an input | Ready | 2 | Strong | 4 + 14 tests | |||
|
|
|
| ||||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Clears Taproot key and script signatures along with MuSig2 pubnonces and partial signatures in PartiallySignedTransaction::AddInput. This matches the existing behavior that drops legacy partial signatures and witnesses when an input is added to a transaction.
Problem: Adding an input alters the transaction and invalidates any existing signatures. PartiallySignedTransaction::AddInput cleared legacy signatures but kept Taproot and MuSig2 signature fields, causing operations like joinpsbts to output PSBTs carrying stale, invalid signatures for the previous transaction.
Evidence of importance:
- Functional test addition in test/functional/rpc_psbt.py demonstrates that joining two PSBTs with signed Taproot inputs previously retained invalid taproot_key_path_sig fields and failed to process cleanly in the wallet, but succeeds with this change (author description and diff).
Risk of a mistake: low (rpc_api, wallet). Inadvertent dropping of Taproot or MuSig2 fields when adding inputs could require signers to re-sign, but existing code already drops legacy signatures here because modifying the input set invalidates them.
Changed since the previous assessment: Now includes the diff and functional test; the code and approach match the previous description.
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- nothing: no pending items or author responses awaited
Agreement
Strong
substantive support, no open objection (fametrano)
Thread notes: Added Yudis-bit to participants. Yudis-bit's Tested ACK is excluded from support entries because the account has no project history and provided no rationale.
Objections, suggestions, and questions: none recorded.
Support:
- fametrano (contributor) (Concept ACK, 2026-10-18) [both: AddInput, PSBTInput::HasSignatures]: With this PR, the v0 branch of `AddInput` clears every field that `PSBTInput::HasSignatures` checks, plus the MuSig2 public nonces, matching btclib-wallet behavior
- jpk68 (contributor) (ACK, 2026-10-18): (no reason given) [not substantive]
Participants:
- fametrano (contributor, support, 1 statements 2026-10-18 to 2026-10-18): Concept ACK; notes AddInput now clears all signature fields checked by HasSignatures plus MuSig2 nonces, matching btclib-wallet behavior, and verified test scenario
- jpk68 (contributor, support, 1 statements 2026-10-18 to 2026-10-18): ACK b40ac85
- Yudis-bit (none, support, 1 statements 2026-10-19 to 2026-10-19): Tested ACK on Windows without rationale; account has no prior project history
Files
14 lines under test/bench/ci.
- test/functional/rpc_psbt.py +14/-0
- src/psbt.cpp +4/-0
Card
The short text the ranking pass compares across PRs.
Clears Taproot and MuSig2 signatures and nonces inside PartiallySignedTransaction::AddInput when adding an input to a PSBT. Modifying a transaction's inputs invalidates existing signatures, but while legacy signatures were previously cleared, Taproot and MuSig2 signatures remained, causing joinpsbts to output PSBTs carrying invalid signatures from the prior transaction. The functional test confirms that joinpsbts with signed Taproot inputs retained stale signatures and failed wallet signing on master, but succeeds with this fix.
Data
thread read through 2026-10-19 (3 statements), head b40ac85ff5
labels: PSBT
Categories
RPC / REST / ZMQ
P3 · bug fix (ranking pass: Moved up 9: grouped with the other PSBT correctness fixes it duplicates review context with (#36343, #36332).)
Corrects `PartiallySignedTransaction::AddInput` to clear stale Taproot and MuSig2 signatures when joining or adding inputs, fixing invalid signature retention in operations like `joinpsbts`.
Membership: Changes PSBT manipulation behavior exposed via RPC (such as `joinpsbts`) in `src/psbt.cpp` and tested in `test/functional/rpc_psbt.py`, meeting the borderline criteria of a PSBT change affecting RPC without wallet code.
Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0