From 502026086c523f2ce12a7d114e7b05ac14b1d68c Mon Sep 17 00:00:00 2001 From: Ruben de Vries Date: Fri, 6 Nov 2015 14:37:58 +0100 Subject: [PATCH] updated _estimateSize for bare multisig input --- lib/transaction/input/multisig.js | 8 +++----- test/transaction/input/multisig.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/transaction/input/multisig.js b/lib/transaction/input/multisig.js index 2767a6f..03a8413 100644 --- a/lib/transaction/input/multisig.js +++ b/lib/transaction/input/multisig.js @@ -200,14 +200,12 @@ MultiSigInput.normalizeSignatures = function(transaction, input, inputIndex, sig }); }; -MultiSigInput.OPCODES_SIZE = 7; // serialized size (<=3) + 0 .. N .. M OP_CHECKMULTISIG -MultiSigInput.SIGNATURE_SIZE = 74; // size (1) + DER (<=72) + sighash (1) -MultiSigInput.PUBKEY_SIZE = 34; // size (1) + DER (<=33) +MultiSigInput.OPCODES_SIZE = 1; // 0 +MultiSigInput.SIGNATURE_SIZE = 73; // size (1) + DER (<=72) MultiSigInput.prototype._estimateSize = function() { return MultiSigInput.OPCODES_SIZE + - this.threshold * MultiSigInput.SIGNATURE_SIZE + - this.publicKeys.length * MultiSigInput.PUBKEY_SIZE; + this.threshold * MultiSigInput.SIGNATURE_SIZE; }; module.exports = MultiSigInput; diff --git a/test/transaction/input/multisig.js b/test/transaction/input/multisig.js index 62d79b7..dd05034 100644 --- a/test/transaction/input/multisig.js +++ b/test/transaction/input/multisig.js @@ -101,7 +101,7 @@ describe('MultiSigInput', function() { .from(output, [public1, public2, public3], 2) .to(address, 1000000); var input = transaction.inputs[0]; - input._estimateSize().should.equal(257); + input._estimateSize().should.equal(147); }); it('uses SIGHASH_ALL by default', function() { var transaction = new Transaction()