channeld: Inform channeld about opening feerate
What changed, and why it matters
This commit is a straightforward internal plumbing change. It adds a new 'opening feerate' value to the messages passed between Core Lightning's main daemon and its per-channel subprocess (channeld). The value is already computed elsewhere; the patch only makes channeld aware of it so future splicing work can use it. There is no bug fix, behavior change, or security-relevant change visible in the diff.
No security action required. Treat as normal feature/refactoring commit. If reviewing for release notes, note it as internal preparation for future splicing improvements.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change extends the channeld wire protocol (channeld_init and channeld_feerates messages) to carry an additional u32 field, feerate_opening, computed by opening_feerate(ld->topology). channeld stores it in struct peer as feerate_opening but the diff does not show any new logic that consumes the field. The test fakenet plugin is updated to unpack the extra field. No validation, arithmetic, or authorization logic is modified.
Changed components
channeld/channeld.cchanneld/channeld_wire.csvlightningd/channel_control.ctests/plugins/channeld_fakenet.cInspect captured patch +17 / −6
diff --git a/channeld/channeld.c b/channeld/channeld.c
index af55a92b..113e7a4b 100644
--- a/channeld/channeld.c
+++ b/channeld/channeld.c
@@ -82,6 +82,9 @@ struct peer {
/* Feerate to be used when creating penalty transactions. */
u32 feerate_penalty;
+ /* Feerate to be used when opening (or splicing) a channel. */
+ u32 feerate_opening;
+
/* Local next per-commit point. */
struct pubkey next_local_per_commit;
@@ -6374,7 +6377,8 @@ static void handle_feerates(struct peer *peer, const u8 *inmsg)
if (!fromwire_channeld_feerates(inmsg, &feerate,
&peer->feerate_min,
&peer->feerate_max,
- &peer->feerate_penalty))
+ &peer->feerate_penalty,
+ &peer->feerate_opening))
master_badmsg(WIRE_CHANNELD_FEERATES, inmsg);
/* BOLT #2:
@@ -6745,6 +6749,7 @@ static void init_channel(struct peer *peer)
&peer->feerate_min,
&peer->feerate_max,
&peer->feerate_penalty,
+ &peer->feerate_opening,
&peer->their_commit_sig,
&funding_pubkey[REMOTE],
&points[REMOTE],
diff --git a/channeld/channeld_wire.csv b/channeld/channeld_wire.csv
index 3e9a7170..0baa87a6 100644
--- a/channeld/channeld_wire.csv
+++ b/channeld/channeld_wire.csv
@@ -31,6 +31,7 @@ msgdata,channeld_init,fee_states,fee_states,
msgdata,channeld_init,feerate_min,u32,
msgdata,channeld_init,feerate_max,u32,
msgdata,channeld_init,feerate_penalty,u32,
+msgdata,channeld_init,feerate_opening,u32,
msgdata,channeld_init,first_commit_sig,bitcoin_signature,
msgdata,channeld_init,remote_fundingkey,pubkey,
msgdata,channeld_init,remote_basepoints,basepoints,
@@ -330,6 +331,7 @@ msgdata,channeld_feerates,feerate,u32,
msgdata,channeld_feerates,min_feerate,u32,
msgdata,channeld_feerates,max_feerate,u32,
msgdata,channeld_feerates,penalty_feerate,u32,
+msgdata,channeld_feerates,opening_feerate,u32,
# master -> channeld: do you have a memleak?
msgtype,channeld_dev_memleak,1033
diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c
index 2e7799e5..c92f463a 100644
--- a/lightningd/channel_control.c
+++ b/lightningd/channel_control.c
@@ -86,7 +86,8 @@ void channel_update_feerates(struct lightningd *ld, const struct channel *channe
msg = towire_channeld_feerates(NULL, feerate,
min_feerate,
max_feerate,
- penalty_feerate(ld->topology));
+ penalty_feerate(ld->topology),
+ opening_feerate(ld->topology));
subd_send_msg(channel->owner, take(msg));
}
@@ -1880,6 +1881,7 @@ bool peer_start_channeld(struct channel *channel,
min_feerate,
max_feerate,
penalty_feerate(ld->topology),
+ opening_feerate(ld->topology),
&channel->last_sig,
&channel->channel_info.remote_fundingkey,
&channel->channel_info.theirbase,
@@ -2676,7 +2678,8 @@ static struct command_result *json_dev_feerate(struct command *cmd,
msg = towire_channeld_feerates(NULL, *feerate,
feerate_min(cmd->ld, NULL),
feerate_max(cmd->ld, NULL),
- penalty_feerate(cmd->ld->topology));
+ penalty_feerate(cmd->ld->topology),
+ opening_feerate(cmd->ld->topology));
subd_send_msg(channel->owner, take(msg));
response = json_stream_success(cmd);
diff --git a/tests/plugins/channeld_fakenet.c b/tests/plugins/channeld_fakenet.c
index 1d3cf613..b31b1352 100644
--- a/tests/plugins/channeld_fakenet.c
+++ b/tests/plugins/channeld_fakenet.c
@@ -959,10 +959,10 @@ failed:
static void handle_feerates(struct info *info, const u8 *inmsg)
{
- u32 feerate, min, max, penalty;
+ u32 feerate, min, max, penalty, opening;
if (!fromwire_channeld_feerates(inmsg, &feerate,
- &min, &max, &penalty))
+ &min, &max, &penalty, &opening))
master_badmsg(WIRE_CHANNELD_FEERATES, inmsg);
/* BOLT #2:
@@ -1054,7 +1054,7 @@ static struct channel *handle_init(struct info *info, const u8 *init_msg)
struct secret last_remote_per_commit_secret;
struct penalty_base *pbases;
struct channel_type *channel_type;
- u32 feerate_min, feerate_max, feerate_penalty;
+ u32 feerate_min, feerate_max, feerate_penalty, feerate_opening;
struct pubkey remote_per_commit;
struct pubkey old_remote_per_commit;
u32 commit_msec;
@@ -1097,6 +1097,7 @@ static struct channel *handle_init(struct info *info, const u8 *init_msg)
&feerate_min,
&feerate_max,
&feerate_penalty,
+ &feerate_opening,
&their_commit_sig,
&funding_pubkey[REMOTE],
&points[REMOTE],
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.