3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 23:32:16 +00:00

Script: fix bug, OP_0/OP_FALSE is not invalid.

This commit is contained in:
Mike Hearn 2013-04-26 13:50:30 +02:00
parent 172f264ee2
commit d537c8017a

View File

@ -591,7 +591,10 @@ public class Script {
continue;
switch(opcode) {
//case OP_0: dont know why this isnt also here in the reference client
case OP_0:
// This is also OP_FALSE (they are both zero).
stack.add(new byte[]{0});
break;
case OP_1NEGATE:
stack.add(Utils.reverseBytes(Utils.encodeMPI(BigInteger.ONE.negate(), false)));
break;
@ -1014,7 +1017,7 @@ public class Script {
break;
default:
throw new ScriptException("Script used a reserved Op Code");
throw new ScriptException("Script used a reserved opcode " + opcode);
}
}
@ -1163,7 +1166,7 @@ public class Script {
throw new ScriptException("Stack empty at end of script execution.");
if (!castToBool(stack.pollLast()))
throw new ScriptException("Script resulted in a non-true stack");
throw new ScriptException("Script resulted in a non-true stack: " + stack);
// P2SH is pay to script hash. It means that the scriptPubKey has a special form which is a valid
// program but it has "useless" form that if evaluated as a normal program always returns true.