txscript/pkscript: Use finalOpcodeData to extract redeem script

This commit is contained in:
Conner Fromknecht 2019-04-19 19:31:33 -07:00 committed by Roy Lee
parent e84398d21e
commit 8588536586

View file

@ -211,11 +211,12 @@ func computeNonWitnessPkScript(sigScript []byte) (PkScript, error) {
// The redeem script will always be the last data push of the
// signature script, so we'll parse the script into opcodes to
// obtain it.
parsedOpcodes, err := parseScript(sigScript)
const scriptVersion = 0
err := checkScriptParses(scriptVersion, sigScript)
if err != nil {
return PkScript{}, err
}
redeemScript := parsedOpcodes[len(parsedOpcodes)-1].data
redeemScript := finalOpcodeData(scriptVersion, sigScript)
scriptHash := hash160(redeemScript)
script, err := payToScriptHashScript(scriptHash)