txscript: Optimize typeOfScript multisig.

This continues the process of converting the typeOfScript function to
use a combination of raw script analysis and the new tokenizer instead
of the far less efficient parsed opcodes.

In particular, for this commit, since the ability to detect multisig
scripts via the new tokenizer is now available, the function is simply
updated to make use of it.
This commit is contained in:
Dave Collins 2019-03-13 01:11:36 -05:00 committed by Roy Lee
parent c85458bc7c
commit cfb6bc9399

View file

@ -509,6 +509,8 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
switch {
case isScriptHashScript(script):
return ScriptHashTy
case isMultisigScript(scriptVersion, script):
return MultiSigTy
}
pops, err := parseScript(script)
@ -524,8 +526,6 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
return WitnessV0PubKeyHashTy
} else if isWitnessScriptHash(pops) {
return WitnessV0ScriptHashTy
} else if isMultiSig(pops) {
return MultiSigTy
} else if isNullData(pops) {
return NullDataTy
}