diff --git a/lib/script/script.js b/lib/script/script.js index ec9a0c38..2a22b088 100644 --- a/lib/script/script.js +++ b/lib/script/script.js @@ -367,7 +367,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) { if (stack.length < 1) throw new ScriptError('UNBALANCED_CONDITIONAL', op, ip); - val = Script.bool(stack.pop()); + val = stack.pop(); if (version == 1 && (flags & constants.flags.VERIFY_MINIMALIF)) { if (val.length > 1) @@ -377,6 +377,8 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) { throw new ScriptError('MINIMALIF'); } + val = Script.bool(val); + if (op === opcodes.OP_NOTIF) val = !val; }