MCPcopy
hub / github.com/btcsuite/btcd / MakeScriptTokenizer

Function MakeScriptTokenizer

txscript/tokenizer.go:194–209  ·  view source on GitHub ↗

MakeScriptTokenizer returns a new instance of a script tokenizer. Passing an unsupported script version will result in the returned tokenizer immediately having an err set accordingly. See the docs for ScriptTokenizer for more details.

(scriptVersion uint16, script []byte)

Source from the content-addressed store, hash-verified

192//
193// See the docs for ScriptTokenizer for more details.
194func MakeScriptTokenizer(scriptVersion uint16, script []byte) ScriptTokenizer {
195 // Only version 0 scripts are currently supported.
196 var err error
197 if scriptVersion != 0 {
198 str := fmt.Sprintf("script version %d is not supported", scriptVersion)
199 err = scriptError(ErrUnsupportedScriptVersion, str)
200
201 }
202 return ScriptTokenizer{
203 version: scriptVersion,
204 script: script,
205 err: err,
206 // We use a value of negative 1 here so the first op code has a value of 0.
207 opcodePos: -1,
208 }
209}

Callers 15

DisasmScriptMethod · 0.85
StepMethod · 0.85
NewEngineFunction · 0.85
mergeMultiSigFunction · 0.85
BenchmarkScriptParsingFunction · 0.85
IsPushOnlyScriptFunction · 0.85
DisasmStringFunction · 0.85
removeOpcodeRawFunction · 0.85
removeOpcodeByDataFunction · 0.85
countSigOpsV0Function · 0.85
finalOpcodeDataFunction · 0.85
checkScriptParsesFunction · 0.85

Calls 1

scriptErrorFunction · 0.85

Tested by 5

BenchmarkScriptParsingFunction · 0.68
TestHasCanonicalPushFunction · 0.68
TestHasCanonicalPushesFunction · 0.68
TestScriptTokenizerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…