Signing a PSBTv2 currently leaves its transaction modifiable flags unchanged. This can tell other software that inputs or outputs can still be changed even when those changes would invalidate the signature. The flag indicating a SIGHASH_SINGLE signature can also be missing. This change updates the flags when a signature is added, according to its sighash type and BIP370. It handles partial signatures too. Calls that only exchange MuSig2 nonces or add no signature leave the flags unchanged. The regression tests cover different sighash types, P2WPKH, Taproot, multisig, and MuSig2 signing, along with PSBTv0 and missing-field controls.
Testing:
- Full rpc_psbt.py passed.
- CTest: 377 passed, 1 skipped because its external test data was unavailable.