script: fix verification of multisig

This commit is contained in:
Fedor Indutny 2014-05-10 10:39:20 +04:00
parent 2c5a622a66
commit 0efe2e2021
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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;
};