branch state.
This commit is contained in:
parent
51f3d7120b
commit
36fc40ee7c
@ -1271,11 +1271,11 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
val = Script.bool(stack.pop());
|
||||
if (op === opcodes.OP_NOTIF)
|
||||
val = !val;
|
||||
state.push(val === true ? 1 : 0);
|
||||
state.push(val);
|
||||
if (!val)
|
||||
negate++;
|
||||
} else {
|
||||
state.push(0);
|
||||
state.push(false);
|
||||
negate++;
|
||||
}
|
||||
break;
|
||||
@ -1283,8 +1283,8 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
case opcodes.OP_ELSE: {
|
||||
if (state.length === 0)
|
||||
throw new ScriptError('UNBALANCED_CONDITIONAL', op, ip);
|
||||
state[state.length - 1] ^= 1;
|
||||
if (state[state.length - 1] === 0)
|
||||
state[state.length - 1] = !state[state.length - 1];
|
||||
if (!state[state.length - 1])
|
||||
negate++;
|
||||
else
|
||||
negate--;
|
||||
@ -1293,7 +1293,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
case opcodes.OP_ENDIF: {
|
||||
if (state.length === 0)
|
||||
throw new ScriptError('UNBALANCED_CONDITIONAL', op, ip);
|
||||
if (state.pop() === 0)
|
||||
if (!state.pop())
|
||||
negate--;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user