Skip to content

Commit

Permalink
txscript: Optimize typeOfScript multisig.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davecgh authored and cfromknecht committed Feb 5, 2021
1 parent f4b4bfa commit b1a191a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions txscript/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass {
switch {
case isScriptHashScript(script):
return ScriptHashTy
case isMultisigScript(scriptVersion, script):
return MultiSigTy
}

pops, err := parseScript(script)
Expand All @@ -516,8 +518,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
}
Expand Down

0 comments on commit b1a191a

Please sign in to comment.