txscript: Optimize GetWitnessSigOpCount
This converts the GetWitnessSigOpCount function to use a combination of raw script analysis and the new tokenizer instead of the far less efficeint parseScript, thereby significantly optimizing the funciton. In particular, it use the recently added countSigOpsv0 in precise mode to avoid calling paseScript.
This commit is contained in:
parent
83442d60bf
commit
43e2a2acb2
1 changed files with 1 additions and 2 deletions
|
@ -955,8 +955,7 @@ func getWitnessSigOps(pkScript []byte, witness wire.TxWitness) int {
|
||||||
len(witness) > 0:
|
len(witness) > 0:
|
||||||
|
|
||||||
witnessScript := witness[len(witness)-1]
|
witnessScript := witness[len(witness)-1]
|
||||||
pops, _ := parseScript(witnessScript)
|
return countSigOpsV0(witnessScript, true)
|
||||||
return getSigOpCount(pops, true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue