Skip to content

Commit 7af70b0

Browse files
committed
Interpreter: Fixed OP_EQUAL behaviour
1 parent c53990b commit 7af70b0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

build/script_interpreter/interpreter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ interpreter.prototype.nextStep = function (mainstack, altstack, script, index) {
359359

360360
/* Bitwise logic*/
361361
case "OP_EQUAL":
362-
var first = mainstack.peek(1);
362+
var first = mainstack.pop();
363363
if (first == null) return -1;
364-
var second = mainstack.peek(2);
364+
var second = mainstack.pop();
365365
if (second == null) return -1;
366366
if (first === second)
367367
mainstack.push(1);
@@ -370,9 +370,9 @@ interpreter.prototype.nextStep = function (mainstack, altstack, script, index) {
370370
break;
371371

372372
case "OP_EQUALVERIFY":
373-
var first = mainstack.peek(1);
373+
var first = mainstack.pop();
374374
if (first == null) return -1;
375-
var second = mainstack.peek(2);
375+
var second = mainstack.pop();
376376
if (second == null) return -1;
377377
if (first === second)
378378
mainstack.push(1);
@@ -640,7 +640,7 @@ interpreter.prototype.nextStep = function (mainstack, altstack, script, index) {
640640
//for (var i = code_separator_index; i < script.length; i++) {
641641
// if (script[i] !== sig) sub_script.push(script[i]);
642642
//}
643-
mainstack.push("TRUE (CHECKSIG UNIMPLEMENTED)");
643+
mainstack.push("1");
644644
break;
645645
// see https://en.bitcoin.it/wiki/OP_CHECKSIG
646646
// use secp256k1 elliptic curve for signature verification
@@ -652,7 +652,7 @@ interpreter.prototype.nextStep = function (mainstack, altstack, script, index) {
652652
mainstack.push(1);
653653
break;
654654
case "OP_CHECKMULTISIGVERIFY":
655-
mainstack.push("TRUE (MULTISIG UNIMPLEMENTED)");
655+
mainstack.push("1");
656656
mainstack.pop();
657657
break;
658658

0 commit comments

Comments
 (0)