channeld, openingd: take into account option_anchor_outputs for fees.

HTLC fees increase (larger weight), and the fee paid by the opener
has to include the anchor outputs (i.e. 660 sats).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-08-14 03:14:02 +09:30
parent 7a2f964d43
commit 85e3b43176
17 changed files with 127 additions and 68 deletions

View File

@@ -218,10 +218,12 @@ void peer_start_closingd(struct channel *channel,
*/
final_commit_feerate = get_feerate(channel->channel_info.fee_states,
channel->opener, LOCAL);
feelimit = commit_tx_base_fee(final_commit_feerate, 0);
feelimit = commit_tx_base_fee(final_commit_feerate, 0,
false /* FIXME-anchor */);
/* Pick some value above slow feerate (or min possible if unknown) */
minfee = commit_tx_base_fee(feerate_min(ld, NULL), 0);
minfee = commit_tx_base_fee(feerate_min(ld, NULL), 0,
false /* FIXME-anchor */);
/* If we can't determine feerate, start at half unilateral feerate. */
feerate = mutual_close_feerate(ld->topology);
@@ -230,7 +232,8 @@ void peer_start_closingd(struct channel *channel,
if (feerate < feerate_floor())
feerate = feerate_floor();
}
startfee = commit_tx_base_fee(feerate, 0);
startfee = commit_tx_base_fee(feerate, 0,
false /* FIXME-anchor */);
if (amount_sat_greater(startfee, feelimit))
startfee = feelimit;