txscript: Optimize typeOfScript for null data scripts
This continues the process of converting the typeOfScript function to use a combination of raw script analysize and the tokenizer instead of parsed opcode, with the intent of significanty optimizing the function. In particular, it converts the detection of null data scripts to use raw script analysis.
This commit is contained in:
parent
d02f97e04a
commit
d80863da92
1 changed files with 3 additions and 2 deletions
|
@ -458,6 +458,8 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
|
||||||
return ScriptHashTy
|
return ScriptHashTy
|
||||||
case isMultisigScript(scriptVersion, script):
|
case isMultisigScript(scriptVersion, script):
|
||||||
return MultiSigTy
|
return MultiSigTy
|
||||||
|
case isNullDataScript(scriptVersion, script):
|
||||||
|
return NullDataTy
|
||||||
}
|
}
|
||||||
|
|
||||||
pops, err := parseScript(script)
|
pops, err := parseScript(script)
|
||||||
|
@ -469,9 +471,8 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
|
||||||
return WitnessV0PubKeyHashTy
|
return WitnessV0PubKeyHashTy
|
||||||
} else if isWitnessScriptHash(pops) {
|
} else if isWitnessScriptHash(pops) {
|
||||||
return WitnessV0ScriptHashTy
|
return WitnessV0ScriptHashTy
|
||||||
} else if isNullData(pops) {
|
|
||||||
return NullDataTy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NonStandardTy
|
return NonStandardTy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue