Merge pull request #75 from matiu/opt/signing

speed up in signing
This commit is contained in:
Ivan Socolsky 2015-02-23 17:14:22 -03:00
commit a266ec94e2
1 changed files with 3 additions and 6 deletions

View File

@ -158,8 +158,7 @@ TxProposal.prototype._addSignaturesToBitcoreTx = function(t, signatures, xpub) {
if (signatures.length != this.inputs.length)
throw new Error('Number of signatures does not match number of inputs');
var oks = 0,
i = 0,
var i = 0,
x = new Bitcore.HDPublicKey(xpub);
_.each(signatures, function(signatureHex) {
@ -173,14 +172,12 @@ TxProposal.prototype._addSignaturesToBitcoreTx = function(t, signatures, xpub) {
sigtype: Bitcore.crypto.Signature.SIGHASH_ALL,
publicKey: pub,
};
t.inputs[i].addSignature(t,s);
i++;
t.applySignature(s);
oks++;
} catch (e) {};
});
if (oks != t.inputs.length)
if (i != t.inputs.length)
throw new Error('Wrong signatures');
};