diff --git a/bitcoin/tx.c b/bitcoin/tx.c index 401c54646..26fdbb975 100644 --- a/bitcoin/tx.c +++ b/bitcoin/tx.c @@ -886,12 +886,15 @@ size_t bitcoin_tx_simple_input_weight(bool p2sh) size_t bitcoin_tx_2of2_input_witness_weight(void) { - /* witness[0] = "" - * witness[1] = sig - * witness[2] = sig - * witness[3] = 2 key key 2 CHECKMULTISIG - */ - return 1 + (1 + 0) + (1 + 72) + (1 + 72) + (1 + 1 + 33 + 33 + 1 + 1); + return 1 + /* Prefix: 4 elements to push on stack */ + (1 + 0) + /* [0]: witness-marker-and-flag */ + (1 + 72) + /* [1] Party A signature and length prefix */ + (1 + 72) + /* [2] Party B signature and length prefix */ + (1 + 1 + /* [3] length prefix and numpushes (2) */ + 33 + /* pubkey A (missing prefix) */ + 33 + /* pubkey B (missing prefix) */ + 1 + 1 /* num sigs required and checkmultisig */ + ); } struct amount_sat change_amount(struct amount_sat excess, u32 feerate_perkw,