()
| 282 | } |
| 283 | |
| 284 | func (s *Script) convertRaw() { |
| 285 | s.data = make([]byte, 0) |
| 286 | for _, e := range s.ParsedOpCodes { |
| 287 | s.data = append(s.data, e.OpValue) |
| 288 | if e.OpValue == opcodes.OP_PUSHDATA1 { |
| 289 | s.data = append(s.data, byte(e.Length)) |
| 290 | } else if e.OpValue == opcodes.OP_PUSHDATA2 { |
| 291 | b := make([]byte, 2) |
| 292 | binary.LittleEndian.PutUint16(b, uint16(e.Length)) |
| 293 | s.data = append(s.data, b...) |
| 294 | } else if e.OpValue == opcodes.OP_PUSHDATA4 { |
| 295 | b := make([]byte, 4) |
| 296 | binary.LittleEndian.PutUint32(b, uint32(e.Length)) |
| 297 | s.data = append(s.data, b...) |
| 298 | } |
| 299 | if e.OpValue <= opcodes.OP_PUSHDATA4 && e.Length > 0 { |
| 300 | s.data = append(s.data, e.Data...) |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | func (s *Script) GetData() []byte { |
| 306 | return s.data |
no test coverage detected