txscript: Define opcodes in hex and sync BC opcodes.

This commit modifies the definition of the opcodes to their hex
counterparts rather than decimal since it is far more common to see
scripts in hex.  This makes it easier when manually looking at script
dumps to correlate opcodes.  However, since there are also cases where it
is useful to see the decimal value of the opcode, the decimal value has
been left as a comment.  Obviously converting the numbers is trivial, but
it is handy when looking at the opcode definitions to already have it
there.

In addition, it syncs the opcodes with the latest Bitcoin Core internal
opcodes for completeness and modifies the tests accordingly.
This commit is contained in:
Dave Collins 2015-04-20 22:01:09 -05:00
parent 0baac03129
commit d6f2b092c0
2 changed files with 315 additions and 298 deletions

View File

@ -31,268 +31,268 @@ type opcode struct {
parsefunc func(*opcode, *Engine, []byte) error parsefunc func(*opcode, *Engine, []byte) error
} }
// These constants are the values of the official opcode used on the btc wiki, // These constants are the values of the official opcodes used on the btc wiki,
// in bitcoind and in most if not all other references and software related to // in bitcoin core and in most if not all other references and software related
// handling BTC scripts. // to handling BTC scripts.
const ( const (
OP_FALSE = 0 // AKA OP_0 OP_0 = 0x00 // 0
OP_0 = 0 OP_FALSE = 0x00 // 0 - AKA OP_0
OP_DATA_1 = 1 OP_DATA_1 = 0x01 // 1
OP_DATA_2 = 2 OP_DATA_2 = 0x02 // 2
OP_DATA_3 = 3 OP_DATA_3 = 0x03 // 3
OP_DATA_4 = 4 OP_DATA_4 = 0x04 // 4
OP_DATA_5 = 5 OP_DATA_5 = 0x05 // 5
OP_DATA_6 = 6 OP_DATA_6 = 0x06 // 6
OP_DATA_7 = 7 OP_DATA_7 = 0x07 // 7
OP_DATA_8 = 8 OP_DATA_8 = 0x08 // 8
OP_DATA_9 = 9 OP_DATA_9 = 0x09 // 9
OP_DATA_10 = 10 OP_DATA_10 = 0x0a // 10
OP_DATA_11 = 11 OP_DATA_11 = 0x0b // 11
OP_DATA_12 = 12 OP_DATA_12 = 0x0c // 12
OP_DATA_13 = 13 OP_DATA_13 = 0x0d // 13
OP_DATA_14 = 14 OP_DATA_14 = 0x0e // 14
OP_DATA_15 = 15 OP_DATA_15 = 0x0f // 15
OP_DATA_16 = 16 OP_DATA_16 = 0x10 // 16
OP_DATA_17 = 17 OP_DATA_17 = 0x11 // 17
OP_DATA_18 = 18 OP_DATA_18 = 0x12 // 18
OP_DATA_19 = 19 OP_DATA_19 = 0x13 // 19
OP_DATA_20 = 20 OP_DATA_20 = 0x14 // 20
OP_DATA_21 = 21 OP_DATA_21 = 0x15 // 21
OP_DATA_22 = 22 OP_DATA_22 = 0x16 // 22
OP_DATA_23 = 23 OP_DATA_23 = 0x17 // 23
OP_DATA_24 = 24 OP_DATA_24 = 0x18 // 24
OP_DATA_25 = 25 OP_DATA_25 = 0x19 // 25
OP_DATA_26 = 26 OP_DATA_26 = 0x1a // 26
OP_DATA_27 = 27 OP_DATA_27 = 0x1b // 27
OP_DATA_28 = 28 OP_DATA_28 = 0x1c // 28
OP_DATA_29 = 29 OP_DATA_29 = 0x1d // 29
OP_DATA_30 = 30 OP_DATA_30 = 0x1e // 30
OP_DATA_31 = 31 OP_DATA_31 = 0x1f // 31
OP_DATA_32 = 32 OP_DATA_32 = 0x20 // 32
OP_DATA_33 = 33 OP_DATA_33 = 0x21 // 33
OP_DATA_34 = 34 OP_DATA_34 = 0x22 // 34
OP_DATA_35 = 35 OP_DATA_35 = 0x23 // 35
OP_DATA_36 = 36 OP_DATA_36 = 0x24 // 36
OP_DATA_37 = 37 OP_DATA_37 = 0x25 // 37
OP_DATA_38 = 38 OP_DATA_38 = 0x26 // 38
OP_DATA_39 = 39 OP_DATA_39 = 0x27 // 39
OP_DATA_40 = 40 OP_DATA_40 = 0x28 // 40
OP_DATA_41 = 41 OP_DATA_41 = 0x29 // 41
OP_DATA_42 = 42 OP_DATA_42 = 0x2a // 42
OP_DATA_43 = 43 OP_DATA_43 = 0x2b // 43
OP_DATA_44 = 44 OP_DATA_44 = 0x2c // 44
OP_DATA_45 = 45 OP_DATA_45 = 0x2d // 45
OP_DATA_46 = 46 OP_DATA_46 = 0x2e // 46
OP_DATA_47 = 47 OP_DATA_47 = 0x2f // 47
OP_DATA_48 = 48 OP_DATA_48 = 0x30 // 48
OP_DATA_49 = 49 OP_DATA_49 = 0x31 // 49
OP_DATA_50 = 50 OP_DATA_50 = 0x32 // 50
OP_DATA_51 = 51 OP_DATA_51 = 0x33 // 51
OP_DATA_52 = 52 OP_DATA_52 = 0x34 // 52
OP_DATA_53 = 53 OP_DATA_53 = 0x35 // 53
OP_DATA_54 = 54 OP_DATA_54 = 0x36 // 54
OP_DATA_55 = 55 OP_DATA_55 = 0x37 // 55
OP_DATA_56 = 56 OP_DATA_56 = 0x38 // 56
OP_DATA_57 = 57 OP_DATA_57 = 0x39 // 57
OP_DATA_58 = 58 OP_DATA_58 = 0x3a // 58
OP_DATA_59 = 59 OP_DATA_59 = 0x3b // 59
OP_DATA_60 = 60 OP_DATA_60 = 0x3c // 60
OP_DATA_61 = 61 OP_DATA_61 = 0x3d // 61
OP_DATA_62 = 62 OP_DATA_62 = 0x3e // 62
OP_DATA_63 = 63 OP_DATA_63 = 0x3f // 63
OP_DATA_64 = 64 OP_DATA_64 = 0x40 // 64
OP_DATA_65 = 65 OP_DATA_65 = 0x41 // 65
OP_DATA_66 = 66 OP_DATA_66 = 0x42 // 66
OP_DATA_67 = 67 OP_DATA_67 = 0x43 // 67
OP_DATA_68 = 68 OP_DATA_68 = 0x44 // 68
OP_DATA_69 = 69 OP_DATA_69 = 0x45 // 69
OP_DATA_70 = 70 OP_DATA_70 = 0x46 // 70
OP_DATA_71 = 71 OP_DATA_71 = 0x47 // 71
OP_DATA_72 = 72 OP_DATA_72 = 0x48 // 72
OP_DATA_73 = 73 OP_DATA_73 = 0x49 // 73
OP_DATA_74 = 74 OP_DATA_74 = 0x4a // 74
OP_DATA_75 = 75 OP_DATA_75 = 0x4b // 75
OP_PUSHDATA1 = 76 OP_PUSHDATA1 = 0x4c // 76
OP_PUSHDATA2 = 77 OP_PUSHDATA2 = 0x4d // 77
OP_PUSHDATA4 = 78 OP_PUSHDATA4 = 0x4e // 78
OP_1NEGATE = 79 OP_1NEGATE = 0x4f // 79
OP_RESERVED = 80 OP_RESERVED = 0x50 // 80
OP_1 = 81 // AKA OP_TRUE OP_1 = 0x51 // 81 - AKA OP_TRUE
OP_TRUE = 81 OP_TRUE = 0x51 // 81
OP_2 = 82 OP_2 = 0x52 // 82
OP_3 = 83 OP_3 = 0x53 // 83
OP_4 = 84 OP_4 = 0x54 // 84
OP_5 = 85 OP_5 = 0x55 // 85
OP_6 = 86 OP_6 = 0x56 // 86
OP_7 = 87 OP_7 = 0x57 // 87
OP_8 = 88 OP_8 = 0x58 // 88
OP_9 = 89 OP_9 = 0x59 // 89
OP_10 = 90 OP_10 = 0x5a // 90
OP_11 = 91 OP_11 = 0x5b // 91
OP_12 = 92 OP_12 = 0x5c // 92
OP_13 = 93 OP_13 = 0x5d // 93
OP_14 = 94 OP_14 = 0x5e // 94
OP_15 = 95 OP_15 = 0x5f // 95
OP_16 = 96 OP_16 = 0x60 // 96
OP_NOP = 97 OP_NOP = 0x61 // 97
OP_VER = 98 OP_VER = 0x62 // 98
OP_IF = 99 OP_IF = 0x63 // 99
OP_NOTIF = 100 OP_NOTIF = 0x64 // 100
OP_VERIF = 101 OP_VERIF = 0x65 // 101
OP_VERNOTIF = 102 OP_VERNOTIF = 0x66 // 102
OP_ELSE = 103 OP_ELSE = 0x67 // 103
OP_ENDIF = 104 OP_ENDIF = 0x68 // 104
OP_VERIFY = 105 OP_VERIFY = 0x69 // 105
OP_RETURN = 106 OP_RETURN = 0x6a // 106
OP_TOALTSTACK = 107 OP_TOALTSTACK = 0x6b // 107
OP_FROMALTSTACK = 108 OP_FROMALTSTACK = 0x6c // 108
OP_2DROP = 109 OP_2DROP = 0x6d // 109
OP_2DUP = 110 OP_2DUP = 0x6e // 110
OP_3DUP = 111 OP_3DUP = 0x6f // 111
OP_2OVER = 112 OP_2OVER = 0x70 // 112
OP_2ROT = 113 OP_2ROT = 0x71 // 113
OP_2SWAP = 114 OP_2SWAP = 0x72 // 114
OP_IFDUP = 115 OP_IFDUP = 0x73 // 115
OP_DEPTH = 116 OP_DEPTH = 0x74 // 116
OP_DROP = 117 OP_DROP = 0x75 // 117
OP_DUP = 118 OP_DUP = 0x76 // 118
OP_NIP = 119 OP_NIP = 0x77 // 119
OP_OVER = 120 OP_OVER = 0x78 // 120
OP_PICK = 121 OP_PICK = 0x79 // 121
OP_ROLL = 122 OP_ROLL = 0x7a // 122
OP_ROT = 123 OP_ROT = 0x7b // 123
OP_SWAP = 124 OP_SWAP = 0x7c // 124
OP_TUCK = 125 OP_TUCK = 0x7d // 125
OP_CAT = 126 OP_CAT = 0x7e // 126
OP_SUBSTR = 127 OP_SUBSTR = 0x7f // 127
OP_LEFT = 128 OP_LEFT = 0x80 // 128
OP_RIGHT = 129 OP_RIGHT = 0x81 // 129
OP_SIZE = 130 OP_SIZE = 0x82 // 130
OP_INVERT = 131 OP_INVERT = 0x83 // 131
OP_AND = 132 OP_AND = 0x84 // 132
OP_OR = 133 OP_OR = 0x85 // 133
OP_XOR = 134 OP_XOR = 0x86 // 134
OP_EQUAL = 135 OP_EQUAL = 0x87 // 135
OP_EQUALVERIFY = 136 OP_EQUALVERIFY = 0x88 // 136
OP_RESERVED1 = 137 OP_RESERVED1 = 0x89 // 137
OP_RESERVED2 = 138 OP_RESERVED2 = 0x8a // 138
OP_1ADD = 139 OP_1ADD = 0x8b // 139
OP_1SUB = 140 OP_1SUB = 0x8c // 140
OP_2MUL = 141 OP_2MUL = 0x8d // 141
OP_2DIV = 142 OP_2DIV = 0x8e // 142
OP_NEGATE = 143 OP_NEGATE = 0x8f // 143
OP_ABS = 144 OP_ABS = 0x90 // 144
OP_NOT = 145 OP_NOT = 0x91 // 145
OP_0NOTEQUAL = 146 OP_0NOTEQUAL = 0x92 // 146
OP_ADD = 147 OP_ADD = 0x93 // 147
OP_SUB = 148 OP_SUB = 0x94 // 148
OP_MUL = 149 OP_MUL = 0x95 // 149
OP_DIV = 150 OP_DIV = 0x96 // 150
OP_MOD = 151 OP_MOD = 0x97 // 151
OP_LSHIFT = 152 OP_LSHIFT = 0x98 // 152
OP_RSHIFT = 153 OP_RSHIFT = 0x99 // 153
OP_BOOLAND = 154 OP_BOOLAND = 0x9a // 154
OP_BOOLOR = 155 OP_BOOLOR = 0x9b // 155
OP_NUMEQUAL = 156 OP_NUMEQUAL = 0x9c // 156
OP_NUMEQUALVERIFY = 157 OP_NUMEQUALVERIFY = 0x9d // 157
OP_NUMNOTEQUAL = 158 OP_NUMNOTEQUAL = 0x9e // 158
OP_LESSTHAN = 159 OP_LESSTHAN = 0x9f // 159
OP_GREATERTHAN = 160 OP_GREATERTHAN = 0xa0 // 160
OP_LESSTHANOREQUAL = 161 OP_LESSTHANOREQUAL = 0xa1 // 161
OP_GREATERTHANOREQUAL = 162 OP_GREATERTHANOREQUAL = 0xa2 // 162
OP_MIN = 163 OP_MIN = 0xa3 // 163
OP_MAX = 164 OP_MAX = 0xa4 // 164
OP_WITHIN = 165 OP_WITHIN = 0xa5 // 165
OP_RIPEMD160 = 166 OP_RIPEMD160 = 0xa6 // 166
OP_SHA1 = 167 OP_SHA1 = 0xa7 // 167
OP_SHA256 = 168 OP_SHA256 = 0xa8 // 168
OP_HASH160 = 169 OP_HASH160 = 0xa9 // 169
OP_HASH256 = 170 OP_HASH256 = 0xaa // 170
OP_CODESEPARATOR = 171 OP_CODESEPARATOR = 0xab // 171
OP_CHECKSIG = 172 OP_CHECKSIG = 0xac // 172
OP_CHECKSIGVERIFY = 173 OP_CHECKSIGVERIFY = 0xad // 173
OP_CHECKMULTISIG = 174 OP_CHECKMULTISIG = 0xae // 174
OP_CHECKMULTISIGVERIFY = 175 OP_CHECKMULTISIGVERIFY = 0xaf // 175
OP_NOP1 = 176 OP_NOP1 = 0xb0 // 176
OP_NOP2 = 177 OP_NOP2 = 0xb1 // 177
OP_NOP3 = 178 OP_NOP3 = 0xb2 // 178
OP_NOP4 = 179 OP_NOP4 = 0xb3 // 179
OP_NOP5 = 180 OP_NOP5 = 0xb4 // 180
OP_NOP6 = 181 OP_NOP6 = 0xb5 // 181
OP_NOP7 = 182 OP_NOP7 = 0xb6 // 182
OP_NOP8 = 183 OP_NOP8 = 0xb7 // 183
OP_NOP9 = 184 OP_NOP9 = 0xb8 // 184
OP_NOP10 = 185 OP_NOP10 = 0xb9 // 185
OP_UNKNOWN186 = 186 OP_UNKNOWN186 = 0xba // 186
OP_UNKNOWN187 = 187 OP_UNKNOWN187 = 0xbb // 187
OP_UNKNOWN188 = 188 OP_UNKNOWN188 = 0xbc // 188
OP_UNKNOWN189 = 189 OP_UNKNOWN189 = 0xbd // 189
OP_UNKNOWN190 = 190 OP_UNKNOWN190 = 0xbe // 190
OP_UNKNOWN191 = 191 OP_UNKNOWN191 = 0xbf // 191
OP_UNKNOWN192 = 192 OP_UNKNOWN192 = 0xc0 // 192
OP_UNKNOWN193 = 193 OP_UNKNOWN193 = 0xc1 // 193
OP_UNKNOWN194 = 194 OP_UNKNOWN194 = 0xc2 // 194
OP_UNKNOWN195 = 195 OP_UNKNOWN195 = 0xc3 // 195
OP_UNKNOWN196 = 196 OP_UNKNOWN196 = 0xc4 // 196
OP_UNKNOWN197 = 197 OP_UNKNOWN197 = 0xc5 // 197
OP_UNKNOWN198 = 198 OP_UNKNOWN198 = 0xc6 // 198
OP_UNKNOWN199 = 199 OP_UNKNOWN199 = 0xc7 // 199
OP_UNKNOWN200 = 200 OP_UNKNOWN200 = 0xc8 // 200
OP_UNKNOWN201 = 201 OP_UNKNOWN201 = 0xc9 // 201
OP_UNKNOWN202 = 202 OP_UNKNOWN202 = 0xca // 202
OP_UNKNOWN203 = 203 OP_UNKNOWN203 = 0xcb // 203
OP_UNKNOWN204 = 204 OP_UNKNOWN204 = 0xcc // 204
OP_UNKNOWN205 = 205 OP_UNKNOWN205 = 0xcd // 205
OP_UNKNOWN206 = 206 OP_UNKNOWN206 = 0xce // 206
OP_UNKNOWN207 = 207 OP_UNKNOWN207 = 0xcf // 207
OP_UNKNOWN208 = 208 OP_UNKNOWN208 = 0xd0 // 208
OP_UNKNOWN209 = 209 OP_UNKNOWN209 = 0xd1 // 209
OP_UNKNOWN210 = 210 OP_UNKNOWN210 = 0xd2 // 210
OP_UNKNOWN211 = 211 OP_UNKNOWN211 = 0xd3 // 211
OP_UNKNOWN212 = 212 OP_UNKNOWN212 = 0xd4 // 212
OP_UNKNOWN213 = 213 OP_UNKNOWN213 = 0xd5 // 213
OP_UNKNOWN214 = 214 OP_UNKNOWN214 = 0xd6 // 214
OP_UNKNOWN215 = 215 OP_UNKNOWN215 = 0xd7 // 215
OP_UNKNOWN216 = 216 OP_UNKNOWN216 = 0xd8 // 216
OP_UNKNOWN217 = 217 OP_UNKNOWN217 = 0xd9 // 217
OP_UNKNOWN218 = 218 OP_UNKNOWN218 = 0xda // 218
OP_UNKNOWN219 = 219 OP_UNKNOWN219 = 0xdb // 219
OP_UNKNOWN220 = 220 OP_UNKNOWN220 = 0xdc // 220
OP_UNKNOWN221 = 221 OP_UNKNOWN221 = 0xdd // 221
OP_UNKNOWN222 = 222 OP_UNKNOWN222 = 0xde // 222
OP_UNKNOWN223 = 223 OP_UNKNOWN223 = 0xdf // 223
OP_UNKNOWN224 = 224 OP_UNKNOWN224 = 0xe0 // 224
OP_UNKNOWN225 = 225 OP_UNKNOWN225 = 0xe1 // 225
OP_UNKNOWN226 = 226 OP_UNKNOWN226 = 0xe2 // 226
OP_UNKNOWN227 = 227 OP_UNKNOWN227 = 0xe3 // 227
OP_UNKNOWN228 = 228 OP_UNKNOWN228 = 0xe4 // 228
OP_UNKNOWN229 = 229 OP_UNKNOWN229 = 0xe5 // 229
OP_UNKNOWN230 = 230 OP_UNKNOWN230 = 0xe6 // 230
OP_UNKNOWN231 = 231 OP_UNKNOWN231 = 0xe7 // 231
OP_UNKNOWN232 = 232 OP_UNKNOWN232 = 0xe8 // 232
OP_UNKNOWN233 = 233 OP_UNKNOWN233 = 0xe9 // 233
OP_UNKNOWN234 = 234 OP_UNKNOWN234 = 0xea // 234
OP_UNKNOWN235 = 235 OP_UNKNOWN235 = 0xeb // 235
OP_UNKNOWN236 = 236 OP_UNKNOWN236 = 0xec // 236
OP_UNKNOWN237 = 237 OP_UNKNOWN237 = 0xed // 237
OP_UNKNOWN238 = 238 OP_UNKNOWN238 = 0xee // 238
OP_UNKNOWN239 = 239 OP_UNKNOWN239 = 0xef // 239
OP_UNKNOWN240 = 240 OP_UNKNOWN240 = 0xf0 // 240
OP_UNKNOWN241 = 241 OP_UNKNOWN241 = 0xf1 // 241
OP_UNKNOWN242 = 242 OP_UNKNOWN242 = 0xf2 // 242
OP_UNKNOWN243 = 243 OP_UNKNOWN243 = 0xf3 // 243
OP_UNKNOWN244 = 244 OP_UNKNOWN244 = 0xf4 // 244
OP_UNKNOWN245 = 245 OP_UNKNOWN245 = 0xf5 // 245
OP_UNKNOWN246 = 246 OP_UNKNOWN246 = 0xf6 // 246
OP_UNKNOWN247 = 247 OP_UNKNOWN247 = 0xf7 // 247
OP_UNKNOWN248 = 248 OP_UNKNOWN248 = 0xf8 // 248
OP_UNKNOWN249 = 249 OP_SMALLDATA = 0xf9 // 249 - bitcoin core internal
OP_UNKNOWN250 = 250 OP_SMALLINTEGER = 0xfa // 250 - bitcoin core internal
OP_UNKNOWN251 = 251 OP_PUBKEYS = 0xfb // 251 - bitcoin core internal
OP_UNKNOWN252 = 252 OP_UNKNOWN252 = 0xfc // 252
OP_PUBKEYHASH = 253 // bitcoind internal, for completeness OP_PUBKEYHASH = 0xfd // 253 - bitcoin core internal
OP_PUBKEY = 254 // bitcoind internal, for completeness OP_PUBKEY = 0xfe // 254 - bitcoin core internal
OP_INVALIDOPCODE = 255 // bitcoind internal, for completeness OP_INVALIDOPCODE = 0xff // 255 - bitcoin core internal
) )
// conditional execution constants // conditional execution constants
@ -815,11 +815,11 @@ var opcodemapPreinit = map[byte]*opcode{
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_UNKNOWN248: {value: OP_UNKNOWN248, name: "OP_UNKNOWN248", length: 1, OP_UNKNOWN248: {value: OP_UNKNOWN248, name: "OP_UNKNOWN248", length: 1,
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_UNKNOWN249: {value: OP_UNKNOWN249, name: "OP_UNKNOWN249", length: 1, OP_SMALLDATA: {value: OP_SMALLDATA, name: "OP_SMALLDATA", length: 1,
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_UNKNOWN250: {value: OP_UNKNOWN250, name: "OP_UNKNOWN250", length: 1, OP_SMALLINTEGER: {value: OP_SMALLINTEGER, name: "OP_SMALLINTEGER",
opfunc: opcodeInvalid}, length: 1, opfunc: opcodeInvalid},
OP_UNKNOWN251: {value: OP_UNKNOWN251, name: "OP_UNKNOWN251", length: 1, OP_PUBKEYS: {value: OP_PUBKEYS, name: "OP_PUBKEYS", length: 1,
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_UNKNOWN252: {value: OP_UNKNOWN252, name: "OP_UNKNOWN252", length: 1, OP_UNKNOWN252: {value: OP_UNKNOWN252, name: "OP_UNKNOWN252", length: 1,
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
@ -827,8 +827,8 @@ var opcodemapPreinit = map[byte]*opcode{
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_PUBKEY: {value: OP_PUBKEY, name: "OP_PUBKEY", length: 1, OP_PUBKEY: {value: OP_PUBKEY, name: "OP_PUBKEY", length: 1,
opfunc: opcodeInvalid}, opfunc: opcodeInvalid},
OP_INVALIDOPCODE: {value: OP_INVALIDOPCODE, name: "OP_INVALIDOPCODE", length: 1, OP_INVALIDOPCODE: {value: OP_INVALIDOPCODE, name: "OP_INVALIDOPCODE",
opfunc: opcodeInvalid}, length: 1, opfunc: opcodeInvalid},
} }
// opcodeOnelineRepls defines opcode names which are replaced when doing a // opcodeOnelineRepls defines opcode names which are replaced when doing a

View File

@ -3798,22 +3798,22 @@ var detailedTests = []detailedTest{
disassembly: "OP_UNKNOWN248", disassembly: "OP_UNKNOWN248",
}, },
{ {
name: "invalid opcode 249", name: "invalid opcode OP_SMALLDATA",
script: []byte{txscript.OP_UNKNOWN249}, script: []byte{txscript.OP_SMALLDATA},
expectedReturn: txscript.ErrStackInvalidOpcode, expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_UNKNOWN249", disassembly: "OP_SMALLDATA",
}, },
{ {
name: "invalid opcode 250", name: "invalid opcode OP_SMALLINTEGER",
script: []byte{txscript.OP_UNKNOWN250}, script: []byte{txscript.OP_SMALLINTEGER},
expectedReturn: txscript.ErrStackInvalidOpcode, expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_UNKNOWN250", disassembly: "OP_SMALLINTEGER",
}, },
{ {
name: "invalid opcode 251", name: "invalid opcode OP_PUBKEYS",
script: []byte{txscript.OP_UNKNOWN251}, script: []byte{txscript.OP_PUBKEYS},
expectedReturn: txscript.ErrStackInvalidOpcode, expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_UNKNOWN251", disassembly: "OP_PUBKEYS",
}, },
{ {
name: "invalid opcode 252", name: "invalid opcode 252",
@ -3821,6 +3821,24 @@ var detailedTests = []detailedTest{
expectedReturn: txscript.ErrStackInvalidOpcode, expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_UNKNOWN252", disassembly: "OP_UNKNOWN252",
}, },
{
name: "invalid opcode OP_PUBKEYHASH",
script: []byte{txscript.OP_PUBKEYHASH},
expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_PUBKEYHASH",
},
{
name: "invalid opcode OP_PUBKEY",
script: []byte{txscript.OP_PUBKEY},
expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_PUBKEY",
},
{
name: "invalid opcode OP_INVALIDOPCODE",
script: []byte{txscript.OP_INVALIDOPCODE},
expectedReturn: txscript.ErrStackInvalidOpcode,
disassembly: "OP_INVALIDOPCODE",
},
{ {
name: "invalid opcode 186 if noexec", name: "invalid opcode 186 if noexec",
@ -4201,22 +4219,22 @@ var detailedTests = []detailedTest{
disassembly: "0 OP_IF OP_UNKNOWN248 OP_ELSE 1 OP_ENDIF", disassembly: "0 OP_IF OP_UNKNOWN248 OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode 249 if noexec", name: "invalid opcode OP_SMALLDATA if noexec",
script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN249, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_SMALLDATA, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
after: [][]byte{{0x01}}, after: [][]byte{{0x01}},
disassembly: "0 OP_IF OP_UNKNOWN249 OP_ELSE 1 OP_ENDIF", disassembly: "0 OP_IF OP_SMALLDATA OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode 250 if noexec", name: "invalid opcode OP_SMALLINTEGER if noexec",
script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN250, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_SMALLINTEGER, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
after: [][]byte{{0x01}}, after: [][]byte{{0x01}},
disassembly: "0 OP_IF OP_UNKNOWN250 OP_ELSE 1 OP_ENDIF", disassembly: "0 OP_IF OP_SMALLINTEGER OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode 251 if noexec", name: "invalid opcode OP_PUBKEYS if noexec",
script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_UNKNOWN251, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_PUBKEYS, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
after: [][]byte{{0x01}}, after: [][]byte{{0x01}},
disassembly: "0 OP_IF OP_UNKNOWN251 OP_ELSE 1 OP_ENDIF", disassembly: "0 OP_IF OP_PUBKEYS OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode 252 if noexec", name: "invalid opcode 252 if noexec",
@ -4224,24 +4242,23 @@ var detailedTests = []detailedTest{
after: [][]byte{{0x01}}, after: [][]byte{{0x01}},
disassembly: "0 OP_IF OP_UNKNOWN252 OP_ELSE 1 OP_ENDIF", disassembly: "0 OP_IF OP_UNKNOWN252 OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode OP_PUBKEY", name: "invalid opcode OP_PUBKEYHASH if noexec",
script: []byte{txscript.OP_PUBKEY}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_PUBKEYHASH, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
expectedReturn: txscript.ErrStackInvalidOpcode, after: [][]byte{{0x01}},
disassembly: "OP_PUBKEY", disassembly: "0 OP_IF OP_PUBKEYHASH OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode OP_PUBKEYHASH", name: "invalid opcode OP_PUBKEY if noexec",
script: []byte{txscript.OP_PUBKEYHASH}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_PUBKEY, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
expectedReturn: txscript.ErrStackInvalidOpcode, after: [][]byte{{0x01}},
disassembly: "OP_PUBKEYHASH", disassembly: "0 OP_IF OP_PUBKEY OP_ELSE 1 OP_ENDIF",
}, },
{ {
name: "invalid opcode OP_INVALIDOPCODE", name: "invalid opcode OP_INVALIDOPCODE if noexec",
script: []byte{txscript.OP_INVALIDOPCODE}, script: []byte{txscript.OP_FALSE, txscript.OP_IF, txscript.OP_INVALIDOPCODE, txscript.OP_ELSE, txscript.OP_TRUE, txscript.OP_ENDIF},
expectedReturn: txscript.ErrStackInvalidOpcode, after: [][]byte{{0x01}},
disassembly: "OP_INVALIDOPCODE", disassembly: "0 OP_IF OP_INVALIDOPCODE OP_ELSE 1 OP_ENDIF",
}, },
} }