3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

Scipt: Remove redundant cases of opcodes.

This commit is contained in:
Nicola Atzei 2017-07-11 16:36:14 +02:00 committed by Andreas Schildbach
parent 106e9363a6
commit e1760ec001

View File

@ -1136,21 +1136,11 @@ public class Script {
if (opcode == OP_TUCK) if (opcode == OP_TUCK)
stack.add(OPSWAPtmpChunk2); stack.add(OPSWAPtmpChunk2);
break; break;
case OP_CAT:
case OP_SUBSTR:
case OP_LEFT:
case OP_RIGHT:
throw new ScriptException(ScriptError.SCRIPT_ERR_DISABLED_OPCODE, "Attempted to use disabled Script Op.");
case OP_SIZE: case OP_SIZE:
if (stack.size() < 1) if (stack.size() < 1)
throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_SIZE on an empty stack"); throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_SIZE on an empty stack");
stack.add(Utils.reverseBytes(Utils.encodeMPI(BigInteger.valueOf(stack.getLast().length), false))); stack.add(Utils.reverseBytes(Utils.encodeMPI(BigInteger.valueOf(stack.getLast().length), false)));
break; break;
case OP_INVERT:
case OP_AND:
case OP_OR:
case OP_XOR:
throw new ScriptException(ScriptError.SCRIPT_ERR_DISABLED_OPCODE, "Attempted to use disabled Script Op.");
case OP_EQUAL: case OP_EQUAL:
if (stack.size() < 2) if (stack.size() < 2)
throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_EQUAL on a stack with size < 2"); throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_EQUAL on a stack with size < 2");
@ -1204,9 +1194,6 @@ public class Script {
stack.add(Utils.reverseBytes(Utils.encodeMPI(numericOPnum, false))); stack.add(Utils.reverseBytes(Utils.encodeMPI(numericOPnum, false)));
break; break;
case OP_2MUL:
case OP_2DIV:
throw new ScriptException(ScriptError.SCRIPT_ERR_DISABLED_OPCODE, "Attempted to use disabled Script Op.");
case OP_ADD: case OP_ADD:
case OP_SUB: case OP_SUB:
case OP_BOOLAND: case OP_BOOLAND:
@ -1298,12 +1285,6 @@ public class Script {
stack.add(Utils.reverseBytes(Utils.encodeMPI(numericOPresult, false))); stack.add(Utils.reverseBytes(Utils.encodeMPI(numericOPresult, false)));
break; break;
case OP_MUL:
case OP_DIV:
case OP_MOD:
case OP_LSHIFT:
case OP_RSHIFT:
throw new ScriptException(ScriptError.SCRIPT_ERR_DISABLED_OPCODE, "Attempted to use disabled Script Op.");
case OP_NUMEQUALVERIFY: case OP_NUMEQUALVERIFY:
if (stack.size() < 2) if (stack.size() < 2)
throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_NUMEQUALVERIFY on a stack with size < 2"); throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_NUMEQUALVERIFY on a stack with size < 2");
@ -1407,7 +1388,7 @@ public class Script {
break; break;
default: default:
throw new ScriptException(ScriptError.SCRIPT_ERR_BAD_OPCODE, "Script used a reserved opcode " + opcode); throw new ScriptException(ScriptError.SCRIPT_ERR_BAD_OPCODE, "Script used a reserved or disabled opcode: " + opcode);
} }
} }