util: add helper ChannelHandshakeConfig -> ChannelHandshakeConfigUpdate
What changed, and why it matters
This commit adds a simple helper that converts a full channel handshake configuration into a partial update object, mirroring an existing helper for another config type. It is a routine code utility with no security relevance visible in the diff or commit message.
No security action needed; treat as normal maintenance/refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces an impl From
Changed components
lightning/src/util/config.rsInspect captured patch +20 / −0
diff --git a/lightning/src/util/config.rs b/lightning/src/util/config.rs
index ebef8c2..c83eb69 100644
--- a/lightning/src/util/config.rs
+++ b/lightning/src/util/config.rs
@@ -1230,6 +1230,26 @@ pub struct ChannelHandshakeConfigUpdate {
pub channel_reserve_proportional_millionths: Option<u32>,
}
+impl From<ChannelHandshakeConfig> for ChannelHandshakeConfigUpdate {
+ fn from(config: ChannelHandshakeConfig) -> Self {
+ Self {
+ announced_channel_max_inbound_htlc_value_in_flight_percentage: Some(
+ config.announced_channel_max_inbound_htlc_value_in_flight_percentage,
+ ),
+ unannounced_channel_max_inbound_htlc_value_in_flight_percentage: Some(
+ config.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
+ ),
+ htlc_minimum_msat: Some(config.our_htlc_minimum_msat),
+ minimum_depth: Some(config.minimum_depth),
+ to_self_delay: Some(config.our_to_self_delay),
+ max_accepted_htlcs: Some(config.our_max_accepted_htlcs),
+ channel_reserve_proportional_millionths: Some(
+ config.their_channel_reserve_proportional_millionths,
+ ),
+ }
+ }
+}
+
impl ChannelHandshakeConfig {
/// Applies the provided handshake config update.
pub fn apply(&mut self, config: &ChannelHandshakeConfigUpdate) {
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.