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