MCPcopy Create free account
hub / github.com/copernet/copernicus / RemoveOpcodeByData

Method RemoveOpcodeByData

model/script/script.go:368–377  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

366}
367
368func (s *Script) RemoveOpcodeByData(data []byte) *Script {
369 parsedOpCodes := make([]opcodes.ParsedOpCode, 0, len(s.ParsedOpCodes))
370 for _, e := range s.ParsedOpCodes {
371 if e.CheckCompactDataPush() && bytes.Equal(e.Data, data) {
372 continue
373 }
374 parsedOpCodes = append(parsedOpCodes, e)
375 }
376 return NewScriptOps(parsedOpCodes)
377}
378
379func (s *Script) RemoveOpCodeByIndex(index int) *Script {
380 opCodesLen := len(s.ParsedOpCodes)

Callers 2

EvalScriptFunction · 0.80

Calls 3

NewScriptOpsFunction · 0.85
CheckCompactDataPushMethod · 0.80
EqualMethod · 0.45

Tested by 1