From 5281541ec653a6399a1510c44244e49d094bfe84 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 15 Nov 2017 20:19:50 +1030 Subject: [PATCH] closingd: start with proper maximum fee, not our guesstimate. Fixes: #348 Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index f1a741c9b..2baff219a 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1887,7 +1887,15 @@ static void peer_start_closingd(struct peer *peer, return; } - maxfee = commit_tx_base_fee(get_feerate(peer->ld->topology), 0); + /* BOLT #2: + * + * A sending node MUST set `fee_satoshis` lower than or equal + * to the base fee of the final commitment transaction as + * calculated in [BOLT + * #3](03-transactions.md#fee-calculation). + */ + maxfee = commit_tx_base_fee(peer->channel_info->feerate_per_kw, 0); + /* FIXME: Real fees! */ minfee = maxfee / 2; startfee = (maxfee + minfee)/2;