Review report

bitcoin/bitcoin: PR #36577

4 suggestions

Optional improvements

Link

[suggestion] · RPC help omits the explicit-default sighash restriction

For PSBTs without a sighash field, explicit default sighashtype values still reject mismatched cosigner signatures while omission now accepts them, but the RPC help does not explain this distinction.

Location: src/psbt.cpp:706 (head).

Details and suggested fix

options.sighash_type activates this guard even when the requested default is not written to PSBT_IN_SIGHASH_TYPE. Thus a Taproot PSBT containing a valid 65-byte SIGHASH_ALL cosigner signature still fails with sighashtype="DEFAULT", while omitting the argument now allows signing. Explicit "ALL" likewise rejects a fieldless P2WSH PSBT containing a NONE partial signature. The explicit-request rejection predates this PR and the new test deliberately preserves it; the new distinction comes from relaxing omission. Both RPCs describe the argument only as the type "to sign with" and advertise those values as defaults. Document in walletprocesspsbt and descriptorprocesspsbt that an explicit value also constrains existing signatures, and that clients must omit the argument to use the new fieldless mixed-sighash behavior.


Link

[suggestion] · DEFAULT-field finalizer assertion does not isolate the mismatch

The DEFAULT-field finalizer assertion uses a PSBT missing signer2's signature for the 2-of-2 leaf, so it remains incomplete independently of the sighash check.

Location: test/functional/rpc_psbt.py:784 (head).

Details and suggested fix

The final negative case reloads psbt, which contains only signer1's ALL|ANYONECANPAY signature for multi_a(2,...). Signer2's contribution is stored separately in signed. Since FinalizePSBT uses DUMMY_SIGNING_PROVIDER, it cannot supply the missing signature, so this assertion would still pass if the finalizer stopped enforcing the DEFAULT field's 64-byte requirement. The adjacent descriptorprocesspsbt assertion does exercise signing-path rejection, and test_sighash_adding covers finalization with a conflicting ALL field. Build this DEFAULT-field case from signed instead. It has both signatures, remains unfinalized because of finalize=False, and is checked as finalizable immediately above, so setting its field to zero isolates the intended rejection.


Link

[suggestion] · Fieldless ECDSA acceptance lacks regression coverage

The new test exercises only Taproot script signatures, so it does not protect the relaxed check for non-ALL ECDSA partial signatures when neither sighash source is present.

Location: test/functional/rpc_psbt.py:757 (head).

Details and suggested fix

The new guard also skips the input.partial_sigs loop when both the field and parameter are absent. Previously, the inferred SIGHASH_ALL rejected existing non-ALL ECDSA signatures. Restoring that ECDSA-only restriction would leave the new tr(H_POINT,multi_a(...)) fixture unchanged, and the existing explicit-field sighash tests do not cover this workflow. Add the same two-key flow using wsh(multi(2,...)): let signer1 sign with NONE and finalize=False, then remove PSBT_IN_SIGHASH_TYPE. Check that signer2's explicit "ALL" request raises the mismatch error, while omitting the argument allows signer2 to sign and produces a transaction that finalizepsbt completes and testmempoolaccept accepts.


Link

[suggestion] · Key-path ANYONECANPAY retention is not exercised

The new retention assertion uses only script-path signatures, so it would not detect removal of the separate ANYONECANPAY check for m_tap_key_sig.

Location: src/psbt.cpp:786 (head).

Details and suggested fix

The fixture uses tr(H_POINT,multi_a(...)) and supplies private keys only for the leaf. H_POINT has no known discrete log, so after removing the sighash field, the script-signature scan alone protects its non_witness_utxo retention assertion. test_sighash_adding does not isolate the key-signature clause either: its explicit ANYONECANPAY field and segwit-v0 input independently prevent removal. Add a single-input tr(<privkey>) case signed with sighashtype="ALL|ANYONECANPAY" and finalize=False. Remove PSBT_IN_SIGHASH_TYPE, reprocess without a sighash and with finalize=False, and assert that non_witness_utxo remains present before finalizing and checking testmempoolaccept.


Coverage details