fix script arithmetic, op_verify, and wallet.fillUnspent.
This commit is contained in:
parent
d28716c98d
commit
500f079632
@ -326,7 +326,7 @@ script.execute = function execute(s, stack, tx, index, recurse) {
|
||||
case 'verify': {
|
||||
if (stack.length === 0)
|
||||
return false;
|
||||
if (new bn(stack[stack.length - 1]).cmpn(0) === 0)
|
||||
if (new bn(stack.pop()).cmpn(0) === 0)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@ -518,6 +518,8 @@ script.execute = function execute(s, stack, tx, index, recurse) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (typeof n === 'boolean')
|
||||
n = new bn(+n);
|
||||
stack.push(n.toArray());
|
||||
break;
|
||||
}
|
||||
@ -596,6 +598,8 @@ script.execute = function execute(s, stack, tx, index, recurse) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (typeof n === 'boolean')
|
||||
n = new bn(+n);
|
||||
res = n.cmpn(0) !== 0;
|
||||
if (o === 'numeqverify') {
|
||||
if (!res)
|
||||
@ -672,6 +676,7 @@ script.execute = function execute(s, stack, tx, index, recurse) {
|
||||
pub = stack.pop();
|
||||
sig = stack.pop();
|
||||
type = sig[sig.length - 1];
|
||||
|
||||
if (!constants.hashTypeByVal[type & 0x1f])
|
||||
return false;
|
||||
|
||||
@ -728,6 +733,7 @@ script.execute = function execute(s, stack, tx, index, recurse) {
|
||||
for (i = 0, j = 0; i < m && j < n; i++) {
|
||||
sig = stack.pop();
|
||||
type = sig[sig.length - 1];
|
||||
|
||||
if (!constants.hashTypeByVal[type & 0x1f])
|
||||
return false;
|
||||
|
||||
|
||||
@ -459,8 +459,8 @@ Wallet.prototype.scriptOutputs = function scriptOutputs(tx, options, outputs) {
|
||||
return outputs.length;
|
||||
};
|
||||
|
||||
Wallet.prototype.fillUnspent = function fillUnspent(tx, unspent, change) {
|
||||
return tx.fillUnspent(tx, unspent, change);
|
||||
Wallet.prototype.fillUnspent = function fillUnspent(tx, change) {
|
||||
return tx.fillUnspent(this.unspent(), change || this.getFullAddress());
|
||||
};
|
||||
|
||||
Wallet.prototype.scriptInputs = function scriptInputs(tx, inputs) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user