mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
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>
This commit is contained in:
parent
4ed13401ce
commit
5deebb85c3
3 changed files with 4 additions and 8 deletions
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
||||||
u16 funding_txout;
|
u16 funding_txout;
|
||||||
u64 funding_satoshi, satoshi_out[NUM_SIDES];
|
u64 funding_satoshi, satoshi_out[NUM_SIDES];
|
||||||
u64 our_dust_limit;
|
u64 our_dust_limit;
|
||||||
u64 minfee, maxfee, sent_fee;
|
u64 minfee, feelimit, maxfee, sent_fee;
|
||||||
s64 last_received_fee = -1;
|
s64 last_received_fee = -1;
|
||||||
enum side funder;
|
enum side funder;
|
||||||
u8 *scriptpubkey[NUM_SIDES], *funding_wscript;
|
u8 *scriptpubkey[NUM_SIDES], *funding_wscript;
|
||||||
|
|
|
@ -14,7 +14,7 @@ closing_init,,local_msatoshi,u64
|
||||||
closing_init,,remote_msatoshi,u64
|
closing_init,,remote_msatoshi,u64
|
||||||
closing_init,,our_dust_limit,u64
|
closing_init,,our_dust_limit,u64
|
||||||
closing_init,,min_fee_satoshi,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,,initial_fee_satoshi,u64
|
||||||
closing_init,,local_scriptpubkey_len,u16
|
closing_init,,local_scriptpubkey_len,u16
|
||||||
closing_init,,local_scriptpubkey,local_scriptpubkey_len*u8
|
closing_init,,local_scriptpubkey,local_scriptpubkey_len*u8
|
||||||
|
|
|
|
@ -1888,7 +1888,7 @@ static void peer_start_closingd(struct peer *peer,
|
||||||
{
|
{
|
||||||
const tal_t *tmpctx = tal_tmpctx(peer);
|
const tal_t *tmpctx = tal_tmpctx(peer);
|
||||||
u8 *initmsg, *local_scriptpubkey;
|
u8 *initmsg, *local_scriptpubkey;
|
||||||
u64 minfee, maxfee, startfee, feelimit;
|
u64 minfee, startfee, feelimit;
|
||||||
u64 num_revocations;
|
u64 num_revocations;
|
||||||
u64 funding_msatoshi, our_msatoshi, their_msatoshi;
|
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],
|
feelimit = commit_tx_base_fee(peer->channel_info->feerate_per_kw[LOCAL],
|
||||||
0);
|
0);
|
||||||
|
|
||||||
maxfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
|
|
||||||
FEERATE_IMMEDIATE), 0);
|
|
||||||
minfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
|
minfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
|
||||||
FEERATE_SLOW), 0);
|
FEERATE_SLOW), 0);
|
||||||
startfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
|
startfee = commit_tx_base_fee(get_feerate(peer->ld->topology,
|
||||||
FEERATE_NORMAL), 0);
|
FEERATE_NORMAL), 0);
|
||||||
|
|
||||||
if (maxfee > feelimit)
|
|
||||||
maxfee = feelimit;
|
|
||||||
if (startfee > feelimit)
|
if (startfee > feelimit)
|
||||||
startfee = feelimit;
|
startfee = feelimit;
|
||||||
if (minfee > feelimit)
|
if (minfee > feelimit)
|
||||||
|
@ -1974,7 +1970,7 @@ static void peer_start_closingd(struct peer *peer,
|
||||||
our_msatoshi / 1000, /* Rounds down */
|
our_msatoshi / 1000, /* Rounds down */
|
||||||
their_msatoshi / 1000, /* Rounds down */
|
their_msatoshi / 1000, /* Rounds down */
|
||||||
peer->our_config.dust_limit_satoshis,
|
peer->our_config.dust_limit_satoshis,
|
||||||
minfee, maxfee, startfee,
|
minfee, feelimit, startfee,
|
||||||
local_scriptpubkey,
|
local_scriptpubkey,
|
||||||
peer->remote_shutdown_scriptpubkey,
|
peer->remote_shutdown_scriptpubkey,
|
||||||
reconnected,
|
reconnected,
|
||||||
|
|
Loading…
Add table
Reference in a new issue