btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.1k stars 2.31k forks source link

btcutil/psbt: finalizer ignores sighash flag when finalizing taproot keyspend signature #2005

Closed guggero closed 11 months ago

guggero commented 11 months ago

The finalizer should check the sighash flag in https://github.com/btcsuite/btcd/blob/2dbc98bdf3dc3f72a749c246cd0171bdd7abafd2/btcutil/psbt/finalizer.go#L522. If it is not equal to txscript.SigHashDefault (and the signature is exactly 64 bytes, so it doesn't yet include the sighash flag), it should be appended to the signature.

Related: https://github.com/btcsuite/btcd/issues/2004