finalOpcodeData returns the data associated with the final opcode in the script. It will return nil if the script fails to parse.
(scriptVersion uint16, script []byte)
| 390 | // finalOpcodeData returns the data associated with the final opcode in the |
| 391 | // script. It will return nil if the script fails to parse. |
| 392 | func finalOpcodeData(scriptVersion uint16, script []byte) []byte { |
| 393 | // Avoid unnecessary work. |
| 394 | if len(script) == 0 { |
| 395 | return nil |
| 396 | } |
| 397 | |
| 398 | var data []byte |
| 399 | tokenizer := MakeScriptTokenizer(scriptVersion, script) |
| 400 | for tokenizer.Next() { |
| 401 | data = tokenizer.Data() |
| 402 | } |
| 403 | if tokenizer.Err() != nil { |
| 404 | return nil |
| 405 | } |
| 406 | return data |
| 407 | } |
| 408 | |
| 409 | // GetPreciseSigOpCount returns the number of signature operations in |
| 410 | // scriptPubKey. If bip16 is true then scriptSig may be searched for the |
no test coverage detected
searching dependent graphs…