Motivation
SignPSBTInput currently rejects valid 65-byte Taproot signatures when PSBT_IN_SIGHASH_TYPE is absent.
A 64-byte Schnorr signature implies SIGHASH_DEFAULT, while a 65-byte signature carries an explicit sighash type. Without an input-level sighash constraint, both encodings are valid.
The existing check applies the locally assumed default to signatures that already specify their own sighash type. This can prevent valid Taproot PSBTs from being finalized.
Changes
Update SignPSBTInput to accept valid 64-byte and 65-byte Taproot signature encodings when no explicit sighash constraint is provided.
Preserve strict sighash matching when the caller or PSBT explicitly specifies a sighash type.
Extend the regression coverage for Taproot key-path and script-path signatures, including mixed sighash types within the same PSBT input.
Testing
Verified locally on macOS using AppleClang.
- Bitcoin Core build completed successfully
psbt_testspassed with 10 test casesrpc_psbt.pypassed after the key-path regression was added- Mixed script-path regression added and awaiting local verification
The final script-path test must pass before the patch is considered ready for upstream review.
References
Refs [#36507](https://github.com/bitcoin/bitcoin/issues/36507)
The issue documents the original failure involving valid Taproot script-path signatures and an absent input-level sighash field.