tx.verify: compare top stack item against zero instead of one.

This commit is contained in:
Christopher Jeffrey 2015-12-18 15:43:17 -08:00
parent 5942209f41
commit 6ae273f84d
2 changed files with 3 additions and 3 deletions

View File

@ -767,7 +767,8 @@ script.exec = function(input, output, tx, i) {
var stack = [];
script.execute(input, stack, tx, i);
var res = script.execute(output, stack, tx, i);
if (!res || stack.length === 0 || !utils.isEqual(stack.pop(), [ 1 ]))
// if (!res || stack.length === 0 || new bn(stack.pop()).cmp(0) !== 0)
if (!res || stack.length === 0 || utils.isEqual(stack.pop(), [ 0 ]))
return false;
return true;
};

View File

@ -594,8 +594,7 @@ TX.prototype.verify = function verify(index, force) {
// Might be necessary for arithmetic:
// if (stack.length === 0 || new bn(stack.pop()).cmp(0) !== 0)
if (stack.length === 0 || !utils.isEqual(stack.pop(), [ 1 ]))
if (stack.length === 0 || utils.isEqual(stack.pop(), [ 0 ]))
return false;
if (bcoin.script.isScripthash(prev)) {