updated _estimateSize for bare multisig input
This commit is contained in:
parent
f9d9fa0622
commit
502026086c
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue