diff --git a/txscript/sign.go b/txscript/sign.go index 4b602448..f9f53925 100644 --- a/txscript/sign.go +++ b/txscript/sign.go @@ -41,15 +41,15 @@ func RawTxInSignature(tx *wire.MsgTx, idx int, subScript []byte, // RawTxInSignatureAlt returns the serialized ECDSA signature for the input idx of // the given transaction, with hashType appended to it. +// +// NOTE: This function is only valid for version 0 scripts. Since the function +// does not accept a script version, the results are undefined for other script +// versions. func RawTxInSignatureAlt(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, key chainec.PrivateKey, sigType dcrec.SignatureType) ([]byte, error) { - parsedScript, err := parseScript(subScript) - if err != nil { - return nil, fmt.Errorf("cannot parse output script: %v", err) - } - hash, err := calcSignatureHash(parsedScript, hashType, tx, idx, nil) + hash, err := CalcSignatureHash(subScript, hashType, tx, idx, nil) if err != nil { return nil, err }