txscript: Optimze typeOfScript pay-to-pubkey
This continues the process of converting the typeOfScript function to use a combination of raw script analysis and the new tokenizer instead of the face less efficient parsed opcodes, with the intent of significantly optimizing the function. In particular, it converts the detection of pay-to-pubkey scripts to use raw script analysis.
This commit is contained in:
parent
1f25921172
commit
b1544cd4a9
1 changed files with 3 additions and 3 deletions
|
@ -471,6 +471,8 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
case isPubKeyScript(script):
|
||||||
|
return PubKeyTy
|
||||||
case isScriptHashScript(script):
|
case isScriptHashScript(script):
|
||||||
return ScriptHashTy
|
return ScriptHashTy
|
||||||
case isMultisigScript(scriptVersion, script):
|
case isMultisigScript(scriptVersion, script):
|
||||||
|
@ -482,9 +484,7 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
|
||||||
return NonStandardTy
|
return NonStandardTy
|
||||||
}
|
}
|
||||||
|
|
||||||
if isPubkey(pops) {
|
if isPubkeyHash(pops) {
|
||||||
return PubKeyTy
|
|
||||||
} else if isPubkeyHash(pops) {
|
|
||||||
return PubKeyHashTy
|
return PubKeyHashTy
|
||||||
} else if isWitnessPubKeyHash(pops) {
|
} else if isWitnessPubKeyHash(pops) {
|
||||||
return WitnessV0PubKeyHashTy
|
return WitnessV0PubKeyHashTy
|
||||||
|
|
Loading…
Add table
Reference in a new issue