From b9c73b176754f92acbadbaf35d10c02682eefd83 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 20 Aug 2024 13:43:40 +0200 Subject: [PATCH] Rename `OpenChannelRequest::is_public` to `is_announced` Referring to announced/unannounced channels as 'public'/'private' regularly leads to confusion on what they are and when which should be used. To avoid perpetuating this confusion, we should avoid referring to announced channels as 'public' in our API. Here we rename the recently introduced field in `OpenChannelRequest` (which doesn't break released API), and will align the pre-existing instances of `is_public` in the following commit (which will break API). --- lightning/src/events/mod.rs | 2 +- lightning/src/ln/channelmanager.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lightning/src/events/mod.rs b/lightning/src/events/mod.rs index d756eff1b..bee7e85c8 100644 --- a/lightning/src/events/mod.rs +++ b/lightning/src/events/mod.rs @@ -1316,7 +1316,7 @@ pub enum Event { /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager channel_type: ChannelTypeFeatures, /// True if this channel is (or will be) publicly-announced. - is_public: bool, + is_announced: bool, /// Channel parameters given by the counterparty. params: msgs::ChannelParameters, }, diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 167ab0ac8..49f7a38ec 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -7423,14 +7423,14 @@ where MsgHandleErrInternal::from_chan_no_close(e, msg.common_fields.temporary_channel_id) )?; let mut pending_events = self.pending_events.lock().unwrap(); - let is_public = (msg.common_fields.channel_flags & 1) == 1; + let is_announced = (msg.common_fields.channel_flags & 1) == 1; pending_events.push_back((events::Event::OpenChannelRequest { temporary_channel_id: msg.common_fields.temporary_channel_id.clone(), counterparty_node_id: counterparty_node_id.clone(), funding_satoshis: msg.common_fields.funding_satoshis, push_msat: msg.push_msat, channel_type, - is_public, + is_announced, params: msg.common_fields.channel_parameters(), }, None)); peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest { -- 2.39.5