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
|
||||
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 type = sig[sig.length - 1];
|
||||
if (type !== 1)
|
||||
|
||||
@ -78,9 +78,6 @@ TX.prototype.input = function input(i, index) {
|
||||
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
|
||||
for (var i = 0; i < this.inputs.length; 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;
|
||||
break;
|
||||
}
|
||||
if (i === this.inputs.length)
|
||||
if (i === this.inputs.length) {
|
||||
this.inputs.push(input);
|
||||
if (input.out.tx)
|
||||
this.funds.iadd(input.out.tx.outputs[input.out.index].value);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user