6 suggestions
Optional improvements
[suggestion] · Missing signature masks DEFAULT-field finalizer rejection
The finalizer assertion uses a one-signature 2-of-2 PSBT, so it stays incomplete even if the DEFAULT-field mismatch check is bypassed.
Location: test/functional/rpc_psbt.py:789 (head).
Details and suggested fix
After the loop, psbt contains only signer1's ALL|ANYONECANPAY signature. Signer2's contribution was stored separately in signed. Because the multi_a(2,...) leaf still lacks its second signature and FinalizePSBT uses DUMMY_SIGNING_PROVIDER, the final assertion cannot distinguish sighash rejection from ordinary incompleteness. Build the DEFAULT-field negative case from signed instead. It contains both signatures, remains unfinalized because of finalize=False, and already has a successful field-absent finalization assertion. Setting its sighash field to zero would then make the mismatch the deciding condition.
[suggestion] · Fieldless non-ALL ECDSA signatures lack regression coverage
The new tests do not exercise acceptance of non-ALL ECDSA partial signatures when both the PSBT sighash field and RPC argument are absent.
Location: test/functional/rpc_psbt.py:758 (head).
Details and suggested fix
The new guard also skips the assumed-ALL comparison for ECDSA partial_sigs, but this fixture uses Taproot multi_a signatures. The existing mismatch and adding tests set or retain the sighash field, so they do not exercise that relaxation. Add the same two-signer flow with wsh(multi(2,...)): let signer1 sign with NONE and finalize=False, then remove PSBT_IN_SIGHASH_TYPE. Assert that signer2 with explicit sighashtype="ALL" gets the mismatch error, while signer2 without the argument can sign. Then assert that finalizepsbt completes and testmempoolaccept accepts the result.
[suggestion] · RPC help omits the explicit-default sighash distinction
For a fieldless, unfinalized PSBT, explicitly passing the usual signing default can reject a cosigner's signature that an omitted argument accepts, but neither processing RPC's help explains the distinction.
Location: src/psbt.cpp:709 (head).
Details and suggested fix
With an existing 65-byte Taproot SIGHASH_ALL signature and no sighash field, explicit sighashtype="DEFAULT" still activates the mismatch check, while omitting the argument now permits signing and finalization. Explicit "ALL" likewise rejects a fieldless non-Taproot input containing a NONE ECDSA partial signature. Both descriptorprocesspsbt and walletprocesspsbt document only the type to sign with and its default. That remains accurate for new signatures, but does not explain why explicitly supplying the usual default changes acceptance. Document this distinction in both help texts, including that omission permits other signers' types when the field is absent. Add a release note for the expanded acceptance rules in these RPCs and finalizepsbt.
[suggestion] · Fieldless unfinalized Taproot key signatures lack coverage
The key-path fixture finalizes its first signature, so reprocessing tests final-witness retention rather than the relaxed check or retention rule for an existing m_tap_key_sig.
Location: test/functional/rpc_psbt.py:805 (head).
Details and suggested fix
This call defaults to finalize=True. The serialized result therefore omits both the sighash field and PSBT_IN_TAP_KEY_SIG, and subsequent processing skips SignPSBTInput because the input already has a final witness. The absent-field fixture above covers only script-path signatures. Add a key-path case that signs tr(<privkey>) with ALL|ANYONECANPAY and finalize=False, removes PSBT_IN_SIGHASH_TYPE, and adds non_witness_utxo. Reprocess without a sighash argument and with finalize=False, assert that the previous transaction is retained, then assert successful finalization and mempool acceptance. This exercises the newly accepted 65-byte key signature and makes is_acp(input.m_tap_key_sig) the deciding retention condition.
[suggestion] · Final-witness tests never exercise annex removal
Core's signer produces annex-free witnesses, so deleting the new annex-stripping branch would not affect the added retention tests.
Location: src/psbt.cpp:791 (head).
Details and suggested fix
Both final-witness fixtures come from descriptorprocesspsbt, whose signer sets m_annex_present=false. Without annex removal, a fieldless key-path witness [sig_81, annex] would lose both items in the subsequent script/control-block removal and incorrectly lose non_witness_utxo. Add a RemoveUnnecessaryTransactions unit test in src/test/psbt_tests.cpp with a Taproot witness_utxo, a non_witness_utxo, no sighash field or partial signatures, and this final witness, asserting retention. Use [sig64, annex65], with the annex starting with 0x50 and ending with 0x81, as a drop control. Annex spends can be consensus-valid but are nonstandard under current policy. No current Core producer of annex witnesses was identified, so production impact is unconfirmed.
[suggestion] · Second signer's DEFAULT sighash is not asserted
The mixed-sighash test would also accept signer2 copying signer1's type, including NONE, because it checks completion and mempool acceptance but not signer2's signature encoding.
Location: test/functional/rpc_psbt.py:778 (head).
Details and suggested fix
The second signing call omits sighashtype, so signer2 should independently use DEFAULT while preserving signer1's existing signature. The following assertions check only previous-transaction retention, finalization, and mempool acceptance. Two valid NONE signatures would satisfy all three in the NONE iteration. Decode signed before finalizing and locate the taproot_script_path_sigs entries by x-only pubkey. Assert that signer1's 65-byte signature is unchanged and has the requested type byte, and that signer2's signature is 64 bytes. This would detect a regression that inferred the new signer's type from the existing signature.