Skip to content

Commit

Permalink
txscript/pkscript: Use finalOpcodeData to extract redeem script
Browse files Browse the repository at this point in the history
  • Loading branch information
cfromknecht authored and Roasbeef committed Nov 17, 2021
1 parent 69f3a39 commit 7533672
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions txscript/pkscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7533672

Please sign in to comment.