Browse Source

channeld: Tell channeld the penalty feerate

`channeld` will start creating the penalty transactions in one of the next
commits, so it should know the penalty feerate.
nifty/pset-pre
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
acbd583e66
  1. 2
      channeld/channel_wire.csv
  2. 10
      channeld/channeld.c
  3. 7
      lightningd/channel_control.c

2
channeld/channel_wire.csv

@ -18,6 +18,7 @@ msgdata,channel_init,their_config,channel_config,
msgdata,channel_init,fee_states,fee_states,
msgdata,channel_init,feerate_min,u32,
msgdata,channel_init,feerate_max,u32,
msgdata,channel_init,feerate_penalty,u32,
msgdata,channel_init,first_commit_sig,bitcoin_signature,
msgdata,channel_init,per_peer_state,per_peer_state,
msgdata,channel_init,remote_fundingkey,pubkey,
@ -178,6 +179,7 @@ msgtype,channel_feerates,1027
msgdata,channel_feerates,feerate,u32,
msgdata,channel_feerates,min_feerate,u32,
msgdata,channel_feerates,max_feerate,u32,
msgdata,channel_feerates,penalty_feerate,u32,
# master -> channeld: do you have a memleak?
msgtype,channel_dev_memleak,1033

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

10
channeld/channeld.c

@ -84,6 +84,9 @@ struct peer {
/* Tolerable amounts for feerate (only relevant for fundee). */
u32 feerate_min, feerate_max;
/* Feerate to be used when creating penalty transactions. */
u32 feerate_penalty;
/* Local next per-commit point. */
struct pubkey next_local_per_commit;
@ -2816,7 +2819,8 @@ static void handle_feerates(struct peer *peer, const u8 *inmsg)
if (!fromwire_channel_feerates(inmsg, &feerate,
&peer->feerate_min,
&peer->feerate_max))
&peer->feerate_max,
&peer->feerate_penalty))
master_badmsg(WIRE_CHANNEL_FEERATES, inmsg);
/* BOLT #2:
@ -3110,7 +3114,9 @@ static void init_channel(struct peer *peer)
&minimum_depth,
&conf[LOCAL], &conf[REMOTE],
&fee_states,
&peer->feerate_min, &peer->feerate_max,
&peer->feerate_min,
&peer->feerate_max,
&peer->feerate_penalty,
&peer->their_commit_sig,
&peer->pps,
&funding_pubkey[REMOTE],

7
lightningd/channel_control.c

@ -38,7 +38,8 @@ static void update_feerates(struct lightningd *ld, struct channel *channel)
msg = towire_channel_feerates(NULL, feerate,
feerate_min(ld, NULL),
feerate_max(ld, NULL));
feerate_max(ld, NULL),
try_get_feerate(ld->topology, FEERATE_PENALTY));
subd_send_msg(channel->owner, take(msg));
}
@ -480,6 +481,7 @@ void peer_start_channeld(struct channel *channel,
channel->channel_info.fee_states,
feerate_min(ld, NULL),
feerate_max(ld, NULL),
try_get_feerate(ld->topology, FEERATE_PENALTY),
&channel->last_sig,
pps,
&channel->channel_info.remote_fundingkey,
@ -819,7 +821,8 @@ static struct command_result *json_dev_feerate(struct command *cmd,
msg = towire_channel_feerates(NULL, *feerate,
feerate_min(cmd->ld, NULL),
feerate_max(cmd->ld, NULL));
feerate_max(cmd->ld, NULL),
try_get_feerate(cmd->ld->topology, FEERATE_PENALTY));
subd_send_msg(channel->owner, take(msg));
response = json_stream_success(cmd);

Loading…
Cancel
Save