From 71bf51e82c57b0d4a68ed3f6d35d94d3e7928d9d Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 13 Mar 2019 01:11:36 -0500 Subject: [PATCH] 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. --- txscript/standard.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/txscript/standard.go b/txscript/standard.go index fb3bb982..dcd75214 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -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 }