more refactoring.
This commit is contained in:
parent
36fc40ee7c
commit
5008a5880c
@ -1265,19 +1265,17 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
switch (op) {
|
||||
case opcodes.OP_IF:
|
||||
case opcodes.OP_NOTIF: {
|
||||
val = false;
|
||||
if (negate === 0) {
|
||||
if (stack.length < 1)
|
||||
throw new ScriptError('UNBALANCED_CONDITIONAL', op, ip);
|
||||
val = Script.bool(stack.pop());
|
||||
if (op === opcodes.OP_NOTIF)
|
||||
val = !val;
|
||||
state.push(val);
|
||||
if (!val)
|
||||
negate++;
|
||||
} else {
|
||||
state.push(false);
|
||||
negate++;
|
||||
}
|
||||
state.push(val);
|
||||
if (!val)
|
||||
negate++;
|
||||
break;
|
||||
}
|
||||
case opcodes.OP_ELSE: {
|
||||
@ -1302,7 +1300,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
throw new ScriptError('BAD_OPCODE', op, ip);
|
||||
}
|
||||
default: {
|
||||
assert.fatal(false, 'Fatal script error.');
|
||||
assert(false, 'Fatal script error.');
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -1550,7 +1548,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
n = n.cmpn(0) !== 0;
|
||||
break;
|
||||
default:
|
||||
assert.fatal(false, 'Fatal script error.');
|
||||
assert(false, 'Fatal script error.');
|
||||
}
|
||||
if (typeof n === 'boolean')
|
||||
n = new bn(n ? 1 : 0);
|
||||
@ -1659,7 +1657,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
n = n1.cmp(n2) > 0 ? n1 : n2;
|
||||
break;
|
||||
default:
|
||||
assert.fatal(false, 'Fatal script error.');
|
||||
assert(false, 'Fatal script error.');
|
||||
}
|
||||
if (typeof n === 'boolean')
|
||||
n = new bn(n ? 1 : 0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user