Skip to content

Commit

Permalink
fixup! txscript: add new RawTxInTapscriptSignature to generate tapsri…
Browse files Browse the repository at this point in the history
…pt sigs
  • Loading branch information
Roasbeef committed Jan 8, 2022
1 parent 30893fa commit da170c1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions txscript/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func TaprootWitnessSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int,
// TODO(roasbeef): actually add code-sep to interface? not really used
// anywhere....
func RawTxInTapscriptSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int,
amt int64, pkScript []byte, tapLeaf TapLeaf, tapScriptRootHash []byte,
hashType SigHashType, key *btcec.PrivateKey) ([]byte, error) {
amt int64, pkScript []byte, tapLeaf TapLeaf, hashType SigHashType,
key *btcec.PrivateKey) ([]byte, error) {

// First, we'll start by compute the top-level taproot sighash.
tapLeafHash := tapLeaf.TapHash()
Expand All @@ -148,10 +148,6 @@ func RawTxInTapscriptSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int,
return nil, err
}

// Before we sign the sighash, we'll need to apply the taptweak to the
// private key based on the tapScriptRootHash.
privKeyTweak := TweakTaprootPrivKey(key, tapScriptRootHash)

// With the sighash constructed, we can sign it with the specified
// private key.
signature, err := schnorr.Sign(privKeyTweak, sigHash)
Expand Down

0 comments on commit da170c1

Please sign in to comment.