script: fix verification of multisig
This commit is contained in:
parent
2c5a622a66
commit
0efe2e2021
@ -186,7 +186,7 @@ script.execute = function execute(s, stack, tx) {
|
|||||||
|
|
||||||
// Get signatures
|
// Get signatures
|
||||||
var succ = 0;
|
var succ = 0;
|
||||||
for (var i = 0, j = 0; i < m, j < n; i++) {
|
for (var i = 0, j = 0; i < m && j < n; i++) {
|
||||||
var sig = stack.pop();
|
var sig = stack.pop();
|
||||||
var type = sig[sig.length - 1];
|
var type = sig[sig.length - 1];
|
||||||
if (type !== 1)
|
if (type !== 1)
|
||||||
|
|||||||
@ -78,9 +78,6 @@ TX.prototype.input = function input(i, index) {
|
|||||||
seq: i.seq === undefined ? 0xffffffff : i.seq
|
seq: i.seq === undefined ? 0xffffffff : i.seq
|
||||||
};
|
};
|
||||||
|
|
||||||
if (input.out.tx)
|
|
||||||
this.funds.iadd(input.out.tx.outputs[input.out.index].value);
|
|
||||||
|
|
||||||
// Try modifying existing input first
|
// Try modifying existing input first
|
||||||
for (var i = 0; i < this.inputs.length; i++) {
|
for (var i = 0; i < this.inputs.length; i++) {
|
||||||
var ex = this.inputs[i];
|
var ex = this.inputs[i];
|
||||||
@ -92,8 +89,11 @@ TX.prototype.input = function input(i, index) {
|
|||||||
ex.script = input.script.length ? input.script : ex.script;
|
ex.script = input.script.length ? input.script : ex.script;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i === this.inputs.length)
|
if (i === this.inputs.length) {
|
||||||
this.inputs.push(input);
|
this.inputs.push(input);
|
||||||
|
if (input.out.tx)
|
||||||
|
this.funds.iadd(input.out.tx.outputs[input.out.index].value);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user