Skip to content

Commit

Permalink
txscript: fix sighash bug in RawTxInTaprootSignature
Browse files Browse the repository at this point in the history
In this commit, we fix a bug in RawTxInTaprootSignature that would cause
the function to not properly apply the sighash flag for non-default
sighash signatures. The logic would end up applying `0x00` as a mask,
which will always be `0x00` on the other end.

The RawTxInTapscriptSignature function was correct, though it had the
ordering switched as it applies the sighash if the type doesn't equal
default.
  • Loading branch information
Roasbeef committed Jan 25, 2023
1 parent 016b3ad commit f6e8292
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion txscript/sign.go
Expand Up @@ -95,7 +95,7 @@ func RawTxInTaprootSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int,

// If this is sighash default, then we can just return the signature
// directly.
if hashType&SigHashDefault == SigHashDefault {
if hashType == SigHashDefault {
return sig, nil
}

Expand Down

0 comments on commit f6e8292

Please sign in to comment.