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)
| 192 | // |
| 193 | // See the docs for ScriptTokenizer for more details. |
| 194 | func 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 | } |
searching dependent graphs…