Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
| Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | if (data.size() <= 65535) { | ||||
| // Could have used OP_PUSHDATA2. | // Could have used OP_PUSHDATA2. | ||||
| return opcode == OP_PUSHDATA2; | return opcode == OP_PUSHDATA2; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| static bool IsOpcodeDisabled(opcodetype opcode, uint32_t flags) { | static bool IsOpcodeDisabled(opcodetype opcode, uint32_t flags) { | ||||
| switch (opcode) { | switch (opcode) { | ||||
| case OP_CAT: | |||||
| case OP_SPLIT: | case OP_SPLIT: | ||||
| case OP_INVERT: | case OP_INVERT: | ||||
| case OP_2MUL: | case OP_2MUL: | ||||
| case OP_2DIV: | case OP_2DIV: | ||||
| case OP_MUL: | case OP_MUL: | ||||
| case OP_DIV: | case OP_DIV: | ||||
| case OP_MOD: | case OP_MOD: | ||||
| case OP_LSHIFT: | case OP_LSHIFT: | ||||
| case OP_RSHIFT: | case OP_RSHIFT: | ||||
| // Disabled opcodes. | // Disabled opcodes. | ||||
| return true; | return true; | ||||
| case OP_CAT: | |||||
| case OP_AND: | case OP_AND: | ||||
| case OP_OR: | case OP_OR: | ||||
| case OP_XOR: | case OP_XOR: | ||||
| case OP_NUM2BIN: | case OP_NUM2BIN: | ||||
| case OP_BIN2NUM: | case OP_BIN2NUM: | ||||
| // Opcodes that have been reenabled. | // Opcodes that have been reenabled. | ||||
| if ((flags & SCRIPT_ENABLE_MONOLITH_OPCODES) == 0) { | if ((flags & SCRIPT_ENABLE_MONOLITH_OPCODES) == 0) { | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 926 Lines • ▼ Show 20 Lines | try { | ||||
| } else { | } else { | ||||
| return set_error( | return set_error( | ||||
| serror, SCRIPT_ERR_CHECKMULTISIGVERIFY); | serror, SCRIPT_ERR_CHECKMULTISIGVERIFY); | ||||
| } | } | ||||
| } | } | ||||
| } break; | } break; | ||||
| // | // | ||||
| // Byte string operations | |||||
| // | |||||
| case OP_CAT: { | |||||
| // (x1 x2 -- out) | |||||
| if (stack.size() < 2) { | |||||
| return set_error( | |||||
| serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | |||||
| } | |||||
| valtype &vch1 = stacktop(-2); | |||||
| valtype &vch2 = stacktop(-1); | |||||
| if (vch1.size() + vch2.size() > | |||||
| MAX_SCRIPT_ELEMENT_SIZE) { | |||||
| return set_error(serror, SCRIPT_ERR_PUSH_SIZE); | |||||
| } | |||||
| vch1.insert(vch1.end(), vch2.begin(), vch2.end()); | |||||
| popstack(stack); | |||||
| } break; | |||||
| // | |||||
| // Conversion operations | // Conversion operations | ||||
| // | // | ||||
| case OP_NUM2BIN: { | case OP_NUM2BIN: { | ||||
| // (in size -- out) | // (in size -- out) | ||||
| if (stack.size() < 2) { | if (stack.size() < 2) { | ||||
| return set_error( | return set_error( | ||||
| serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 509 Lines • Show Last 20 Lines | |||||