txscript/pkscript: Use finalOpcodeData to extract redeem script
This commit is contained in:
parent
69f3a39c1c
commit
7533672993
1 changed files with 3 additions and 2 deletions
|
@ -211,11 +211,12 @@ func computeNonWitnessPkScript(sigScript []byte) (PkScript, error) {
|
||||||
// The redeem script will always be the last data push of the
|
// The redeem script will always be the last data push of the
|
||||||
// signature script, so we'll parse the script into opcodes to
|
// signature script, so we'll parse the script into opcodes to
|
||||||
// obtain it.
|
// obtain it.
|
||||||
parsedOpcodes, err := parseScript(sigScript)
|
const scriptVersion = 0
|
||||||
|
err := checkScriptParses(scriptVersion, sigScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return PkScript{}, err
|
return PkScript{}, err
|
||||||
}
|
}
|
||||||
redeemScript := parsedOpcodes[len(parsedOpcodes)-1].data
|
redeemScript := finalOpcodeData(scriptVersion, sigScript)
|
||||||
|
|
||||||
scriptHash := hash160(redeemScript)
|
scriptHash := hash160(redeemScript)
|
||||||
script, err := payToScriptHashScript(scriptHash)
|
script, err := payToScriptHashScript(scriptHash)
|
||||||
|
|
Loading…
Reference in a new issue