Browse Source

closingd: use the final commitment tx fee as the maximum.

We shouldn't fail negotiation just because they exceeded what we thought
fair: we're better off as long as it's actually <= final commitment fee.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
5deebb85c3
  1. 2
      closingd/closing.c
  2. 2
      closingd/closing_wire.csv
  3. 8
      lightningd/peer_control.c

2
closingd/closing.c

@ -168,7 +168,7 @@ int main(int argc, char *argv[])
u16 funding_txout;
u64 funding_satoshi, satoshi_out[NUM_SIDES];
u64 our_dust_limit;
u64 minfee, maxfee, sent_fee;
u64 minfee, feelimit, maxfee, sent_fee;
s64 last_received_fee = -1;
enum side funder;
u8 *scriptpubkey[NUM_SIDES], *funding_wscript;

2
closingd/closing_wire.csv

@ -14,7 +14,7 @@ closing_init,,local_msatoshi,u64
closing_init,,remote_msatoshi,u64
closing_init,,our_dust_limit,u64
closing_init,,min_fee_satoshi,u64
closing_init,,max_fee_satoshi,u64
closing_init,,fee_limit_satoshi,u64
closing_init,,initial_fee_satoshi,u64
closing_init,,local_scriptpubkey_len,u16
closing_init,,local_scriptpubkey,local_scriptpubkey_len*u8

Can't render this file because it has a wrong number of fields in line 3.

8
lightningd/peer_control.c

@ -1888,7 +1888,7 @@ static void peer_start_closingd(struct peer *peer,
{
const tal_t *tmpctx = tal_tmpctx(peer);
u8 *initmsg, *local_scriptpubkey;
u64 minfee, maxfee, startfee, feelimit;
u64 minfee, startfee, feelimit;
u64 num_revocations;
u64 funding_msatoshi, our_msatoshi, their_msatoshi;
@ -1936,15 +1936,11 @@ static void peer_start_closingd(struct peer *peer,
feelimit = commit_tx_base_fee(peer->channel_info->feerate_per_kw[LOCAL],
0);
maxfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
FEERATE_IMMEDIATE), 0);
minfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
FEERATE_SLOW), 0);
startfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
FEERATE_NORMAL), 0);
if (maxfee > feelimit)
maxfee = feelimit;
if (startfee > feelimit)
startfee = feelimit;
if (minfee > feelimit)
@ -1974,7 +1970,7 @@ static void peer_start_closingd(struct peer *peer,
our_msatoshi / 1000, /* Rounds down */
their_msatoshi / 1000, /* Rounds down */
peer->our_config.dust_limit_satoshis,
minfee, maxfee, startfee,
minfee, feelimit, startfee,
local_scriptpubkey,
peer->remote_shutdown_scriptpubkey,
reconnected,

Loading…
Cancel
Save