From 8588536586cf2e350bf190a96400ce1bd5f09de1 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Fri, 19 Apr 2019 19:31:33 -0700 Subject: [PATCH] txscript/pkscript: Use finalOpcodeData to extract redeem script --- txscript/pkscript.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/txscript/pkscript.go b/txscript/pkscript.go index 0703ef5d..f5b11e6d 100644 --- a/txscript/pkscript.go +++ b/txscript/pkscript.go @@ -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)