MCPcopy Create free account
hub / github.com/ElementsProject/lightning / closing_tx_weight_estimate

Function closing_tx_weight_estimate

closingd/closingd.c:570–595  ·  view source on GitHub ↗

Figure out what weight we actually expect for this closing tx (using zero fees * gives the largest possible tx: larger values might omit outputs). */

Source from the content-addressed store, hash-verified

568/* Figure out what weight we actually expect for this closing tx (using zero fees
569 * gives the largest possible tx: larger values might omit outputs). */
570static size_t closing_tx_weight_estimate(u8 *scriptpubkey[NUM_SIDES],
571 const u8 *funding_wscript,
572 const struct amount_sat *out,
573 struct amount_sat funding_sats,
574 struct amount_sat dust_limit,
575 u32 *local_wallet_index,
576 const struct ext_key *local_wallet_ext_key)
577{
578 /* We create a dummy close */
579 struct bitcoin_tx *tx;
580 struct bitcoin_outpoint dummy_funding;
581
582 memset(&dummy_funding, 0, sizeof(dummy_funding));
583 tx = create_close_tx(tmpctx, chainparams,
584 local_wallet_index, local_wallet_ext_key,
585 scriptpubkey[LOCAL], scriptpubkey[REMOTE],
586 funding_wscript,
587 &dummy_funding,
588 funding_sats,
589 out[LOCAL],
590 out[REMOTE],
591 dust_limit);
592
593 /* We will have to append the witness */
594 return bitcoin_tx_weight(tx) + bitcoin_tx_2of2_input_witness_weight();
595}
596
597/* Get the minimum and desired fees */
598static void calc_fee_bounds(size_t expected_weight,

Callers 1

mainFunction · 0.85

Calls 3

create_close_txFunction · 0.85
bitcoin_tx_weightFunction · 0.85

Tested by

no test coverage detected