Figure out what weight we actually expect for this closing tx (using zero fees * gives the largest possible tx: larger values might omit outputs). */
| 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). */ |
| 570 | static 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 */ |
| 598 | static void calc_fee_bounds(size_t expected_weight, |
no test coverage detected