(res, w []byte)
| 82 | } |
| 83 | |
| 84 | func appendData(res, w []byte) []byte { |
| 85 | if len(w) < opcodes.OP_PUSHDATA1 { |
| 86 | res = append(res, byte(len(w))) |
| 87 | } else if len(w) <= 0xff { |
| 88 | res = append(res, []byte{opcodes.OP_PUSHDATA1, byte(len(w))}...) |
| 89 | } else if len(w) <= 0xffff { |
| 90 | res = append(res, opcodes.OP_PUSHDATA2) |
| 91 | buf := make([]byte, 2) |
| 92 | binary.LittleEndian.PutUint16(buf, uint16(len(w))) |
| 93 | res = append(res, buf...) |
| 94 | } else { |
| 95 | res = append(res, opcodes.OP_PUSHDATA4) |
| 96 | buf := make([]byte, 4) |
| 97 | binary.LittleEndian.PutUint32(buf, uint32(len(w))) |
| 98 | res = append(res, buf...) |
| 99 | } |
| 100 | |
| 101 | res = append(res, w...) |
| 102 | return res |
| 103 | } |
| 104 | |
| 105 | var scriptFlagMap = map[string]uint32{ |
| 106 | "NONE": script.ScriptVerifyNone, |
no test coverage detected