tx.verify: compare top stack item against zero instead of one.
This commit is contained in:
parent
5942209f41
commit
6ae273f84d
@ -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;
|
||||
};
|
||||
|
||||
@ -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)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user