Skip to content

Commit

Permalink
fix: restore global fee settings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schmoock committed Feb 18, 2019
1 parent cd8af25 commit 055d897
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions channeld/channel_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ channel_init,,old_remote_per_commit,struct pubkey
channel_init,,funder,enum side
channel_init,,fee_base,u32
channel_init,,fee_proportional,u32
channel_init,,fee_base_global,u32
channel_init,,fee_proportional_global,u32
channel_init,,local_msatoshi,u64
channel_init,,our_basepoints,struct basepoints
channel_init,,our_funding_pubkey,struct pubkey
Expand Down
12 changes: 12 additions & 0 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ struct peer {
u32 fee_base;
u32 fee_per_satoshi;

/* fee rates used for restoring global settings */
u32 fee_base_global;
u32 fee_per_satoshi_global;

/* The scriptpubkey to use for shutting down. */
u8 *final_scriptpubkey;

Expand Down Expand Up @@ -2494,6 +2498,12 @@ static void handle_json_feerates(struct peer *peer, const u8 *inmsg)
&peer->fee_per_satoshi))
master_badmsg(WIRE_CHANNEL_JSON_FEERATES, inmsg);

// setting values to 0 means restore global values
if (peer->fee_base == 0)
peer->fee_base = peer->fee_base_global;
if (peer->fee_per_satoshi == 0)
peer->fee_per_satoshi = peer->fee_per_satoshi_global;

send_channel_update(peer, 0);
}

Expand Down Expand Up @@ -2716,6 +2726,8 @@ static void init_channel(struct peer *peer)
&funder,
&peer->fee_base,
&peer->fee_per_satoshi,
&peer->fee_base_global,
&peer->fee_per_satoshi_global,
&local_msatoshi,
&points[LOCAL],
&funding_pubkey[LOCAL],
Expand Down
2 changes: 2 additions & 0 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ void peer_start_channeld(struct channel *channel,
channel->funder,
fee_base,
fee_per_satoshi,
cfg->fee_base,
cfg->fee_per_satoshi,
channel->our_msatoshi,
&channel->local_basepoints,
&channel->local_funding_pubkey,
Expand Down

0 comments on commit 055d897

Please sign in to comment.