]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Rename `announced_channel` to `is_announced_for_forwarding`
authorElias Rohrer <dev@tnull.de>
Thu, 29 Aug 2024 18:16:51 +0000 (20:16 +0200)
committerElias Rohrer <dev@tnull.de>
Thu, 29 Aug 2024 19:22:22 +0000 (21:22 +0200)
.. we rename the flag configuring whether we announce a channel or not.

fuzz/src/chanmon_consistency.rs
lightning/src/ln/channel.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/invoice_utils.rs
lightning/src/ln/monitor_tests.rs
lightning/src/ln/onion_route_tests.rs
lightning/src/ln/priv_short_conf_tests.rs
lightning/src/ln/shutdown_tests.rs
lightning/src/util/config.rs

index 84cc4bf260f582e36f422092397550735ffc1de7..1af33cf84380b625fc2953e8978538af9cdc4910 100644 (file)
@@ -693,7 +693,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
 
                        let mut config = UserConfig::default();
                        config.channel_config.forwarding_fee_proportional_millionths = 0;
-                       config.channel_handshake_config.announced_channel = true;
+                       config.channel_handshake_config.announce_for_forwarding = true;
                        if anchors {
                                config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
                                config.manually_accept_inbound_channels = true;
@@ -738,7 +738,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
 
                        let mut config = UserConfig::default();
                        config.channel_config.forwarding_fee_proportional_millionths = 0;
-                       config.channel_handshake_config.announced_channel = true;
+                       config.channel_handshake_config.announce_for_forwarding = true;
                        if anchors {
                                config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
                                config.manually_accept_inbound_channels = true;
index f4d55f9169375c66c5b4be81fc5d2a6ab28e2de0..f91de27f89246a45b88e33f9ec3513ddeaf328dd 100644 (file)
@@ -1515,7 +1515,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
                        SP::Target: SignerProvider,
        {
                let logger = WithContext::from(logger, Some(counterparty_node_id), Some(open_channel_fields.temporary_channel_id), None);
-               let announced_channel = if (open_channel_fields.channel_flags & 1) == 1 { true } else { false };
+               let announce_for_forwarding = if (open_channel_fields.channel_flags & 1) == 1 { true } else { false };
 
                let channel_value_satoshis = our_funding_satoshis.saturating_add(open_channel_fields.funding_satoshis);
 
@@ -1589,7 +1589,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
                // Convert things into internal flags and prep our state:
 
                if config.channel_handshake_limits.force_announced_channel_preference {
-                       if config.channel_handshake_config.announced_channel != announced_channel {
+                       if config.channel_handshake_config.announce_for_forwarding != announce_for_forwarding {
                                return Err(ChannelError::close("Peer tried to open channel but their announcement preference is different from ours".to_owned()));
                        }
                }
@@ -1689,7 +1689,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
 
                        config: LegacyChannelConfig {
                                options: config.channel_config.clone(),
-                               announced_channel,
+                               announce_for_forwarding,
                                commit_upfront_shutdown_pubkey: config.channel_handshake_config.commit_upfront_shutdown_pubkey,
                        },
 
@@ -1921,7 +1921,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
 
                        config: LegacyChannelConfig {
                                options: config.channel_config.clone(),
-                               announced_channel: config.channel_handshake_config.announced_channel,
+                               announce_for_forwarding: config.channel_handshake_config.announce_for_forwarding,
                                commit_upfront_shutdown_pubkey: config.channel_handshake_config.commit_upfront_shutdown_pubkey,
                        },
 
@@ -2066,7 +2066,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
        }
 
        pub fn should_announce(&self) -> bool {
-               self.config.announced_channel
+               self.config.announce_for_forwarding
        }
 
        pub fn is_outbound(&self) -> bool {
@@ -6920,7 +6920,7 @@ impl<SP: Deref> Channel<SP> where
        fn get_channel_announcement<NS: Deref>(
                &self, node_signer: &NS, chain_hash: ChainHash, user_config: &UserConfig,
        ) -> Result<msgs::UnsignedChannelAnnouncement, ChannelError> where NS::Target: NodeSigner {
-               if !self.context.config.announced_channel {
+               if !self.context.config.announce_for_forwarding {
                        return Err(ChannelError::Ignore("Channel is not available for public announcements".to_owned()));
                }
                if !self.context.is_usable() {
@@ -7778,7 +7778,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
                                delayed_payment_basepoint: keys.delayed_payment_basepoint.to_public_key(),
                                htlc_basepoint: keys.htlc_basepoint.to_public_key(),
                                first_per_commitment_point,
-                               channel_flags: if self.context.config.announced_channel {1} else {0},
+                               channel_flags: if self.context.config.announce_for_forwarding {1} else {0},
                                shutdown_scriptpubkey: Some(match &self.context.shutdown_scriptpubkey {
                                        Some(script) => script.clone().into_inner(),
                                        None => Builder::new().into_script(),
@@ -7943,8 +7943,8 @@ pub(super) fn channel_type_from_open_channel(
                if channel_type.requires_unknown_bits_from(&our_supported_features) {
                        return Err(ChannelError::close("Channel Type contains unsupported features".to_owned()));
                }
-               let announced_channel = if (common_fields.channel_flags & 1) == 1 { true } else { false };
-               if channel_type.requires_scid_privacy() && announced_channel {
+               let announce_for_forwarding = if (common_fields.channel_flags & 1) == 1 { true } else { false };
+               if channel_type.requires_scid_privacy() && announce_for_forwarding {
                        return Err(ChannelError::close("SCID Alias/Privacy Channel Type cannot be set on a public channel".to_owned()));
                }
                Ok(channel_type.clone())
@@ -8317,7 +8317,7 @@ impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
                                delayed_payment_basepoint: keys.delayed_payment_basepoint.to_public_key(),
                                htlc_basepoint: keys.htlc_basepoint.to_public_key(),
                                first_per_commitment_point,
-                               channel_flags: if self.context.config.announced_channel {1} else {0},
+                               channel_flags: if self.context.config.announce_for_forwarding {1} else {0},
                                shutdown_scriptpubkey: Some(match &self.context.shutdown_scriptpubkey {
                                        Some(script) => script.clone().into_inner(),
                                        None => Builder::new().into_script(),
@@ -8496,7 +8496,7 @@ fn get_initial_channel_type(config: &UserConfig, their_features: &InitFeatures)
        // available. If it's private, we first try `scid_privacy` as it provides better privacy
        // with no other changes, and fall back to `only_static_remotekey`.
        let mut ret = ChannelTypeFeatures::only_static_remote_key();
-       if !config.channel_handshake_config.announced_channel &&
+       if !config.channel_handshake_config.announce_for_forwarding &&
                config.channel_handshake_config.negotiate_scid_privacy &&
                their_features.supports_scid_privacy() {
                ret.set_scid_privacy_required();
@@ -8968,7 +8968,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
                        // Read the old serialization of the ChannelConfig from version 0.0.98.
                        config.as_mut().unwrap().options.forwarding_fee_proportional_millionths = Readable::read(reader)?;
                        config.as_mut().unwrap().options.cltv_expiry_delta = Readable::read(reader)?;
-                       config.as_mut().unwrap().announced_channel = Readable::read(reader)?;
+                       config.as_mut().unwrap().announce_for_forwarding = Readable::read(reader)?;
                        config.as_mut().unwrap().commit_upfront_shutdown_pubkey = Readable::read(reader)?;
                } else {
                        // Read the 8 bytes of backwards-compatibility ChannelConfig data.
@@ -10287,7 +10287,7 @@ mod tests {
 
                let counterparty_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
                let mut config = UserConfig::default();
-               config.channel_handshake_config.announced_channel = false;
+               config.channel_handshake_config.announce_for_forwarding = false;
                let mut chan = OutboundV1Channel::<&Keys>::new(&LowerBoundedFeeEstimator::new(&feeest), &&keys_provider, &&keys_provider, counterparty_node_id, &channelmanager::provided_init_features(&config), 10_000_000, 0, 42, &config, 0, 42, None, &*logger).unwrap(); // Nothing uses their network key in this test
                chan.context.holder_dust_limit_satoshis = 546;
                chan.context.counterparty_selected_channel_reserve_satoshis = Some(0); // Filled in in accept_channel
index decbb332663f2b5b1b7e9c97d03118d788d73b45..b40277fd191d4ca32accb62a9f7a0ed6bfd325fe 100644 (file)
@@ -1448,7 +1448,7 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c: 'd, 'd>(nodes:
 
 pub fn create_unannounced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, 'c, 'd>>, a: usize, b: usize, channel_value: u64, push_msat: u64) -> (msgs::ChannelReady, Transaction) {
        let mut no_announce_cfg = test_default_channel_config();
-       no_announce_cfg.channel_handshake_config.announced_channel = false;
+       no_announce_cfg.channel_handshake_config.announce_for_forwarding = false;
        nodes[a].node.create_channel(nodes[b].node.get_our_node_id(), channel_value, push_msat, 42, None, Some(no_announce_cfg)).unwrap();
        let open_channel = get_event_msg!(nodes[a], MessageSendEvent::SendOpenChannel, nodes[b].node.get_our_node_id());
        nodes[b].node.handle_open_channel(&nodes[a].node.get_our_node_id(), &open_channel);
@@ -3235,7 +3235,7 @@ pub fn test_default_channel_config() -> UserConfig {
        // Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
        // tests so that our script-length checks don't fail (see ACCEPTED_HTLC_SCRIPT_WEIGHT).
        default_config.channel_config.cltv_expiry_delta = MIN_CLTV_EXPIRY_DELTA;
-       default_config.channel_handshake_config.announced_channel = true;
+       default_config.channel_handshake_config.announce_for_forwarding = true;
        default_config.channel_handshake_limits.force_announced_channel_preference = false;
        // When most of our tests were written, the default HTLC minimum was fixed at 1000.
        // It now defaults to 1, so we simply set it to the expected value here.
index 12f1466e02568903781d0143d80c1c4959661d18..6ab9dec68748de243a449300f431c2eaa3232681 100644 (file)
@@ -2475,11 +2475,11 @@ fn channel_monitor_network_test() {
 fn test_justice_tx_htlc_timeout() {
        // Test justice txn built on revoked HTLC-Timeout tx, against both sides
        let mut alice_config = test_default_channel_config();
-       alice_config.channel_handshake_config.announced_channel = true;
+       alice_config.channel_handshake_config.announce_for_forwarding = true;
        alice_config.channel_handshake_limits.force_announced_channel_preference = false;
        alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
        let mut bob_config = test_default_channel_config();
-       bob_config.channel_handshake_config.announced_channel = true;
+       bob_config.channel_handshake_config.announce_for_forwarding = true;
        bob_config.channel_handshake_limits.force_announced_channel_preference = false;
        bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
        let user_cfgs = [Some(alice_config), Some(bob_config)];
@@ -2538,11 +2538,11 @@ fn test_justice_tx_htlc_timeout() {
 fn test_justice_tx_htlc_success() {
        // Test justice txn built on revoked HTLC-Success tx, against both sides
        let mut alice_config = test_default_channel_config();
-       alice_config.channel_handshake_config.announced_channel = true;
+       alice_config.channel_handshake_config.announce_for_forwarding = true;
        alice_config.channel_handshake_limits.force_announced_channel_preference = false;
        alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
        let mut bob_config = test_default_channel_config();
-       bob_config.channel_handshake_config.announced_channel = true;
+       bob_config.channel_handshake_config.announce_for_forwarding = true;
        bob_config.channel_handshake_limits.force_announced_channel_preference = false;
        bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
        let user_cfgs = [Some(alice_config), Some(bob_config)];
@@ -8017,16 +8017,16 @@ fn test_channel_update_has_correct_htlc_maximum_msat() {
        // 2. MUST be set to less than or equal to the `max_htlc_value_in_flight_msat` received from the peer.
 
        let mut config_30_percent = UserConfig::default();
-       config_30_percent.channel_handshake_config.announced_channel = true;
+       config_30_percent.channel_handshake_config.announce_for_forwarding = true;
        config_30_percent.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 30;
        let mut config_50_percent = UserConfig::default();
-       config_50_percent.channel_handshake_config.announced_channel = true;
+       config_50_percent.channel_handshake_config.announce_for_forwarding = true;
        config_50_percent.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 50;
        let mut config_95_percent = UserConfig::default();
-       config_95_percent.channel_handshake_config.announced_channel = true;
+       config_95_percent.channel_handshake_config.announce_for_forwarding = true;
        config_95_percent.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 95;
        let mut config_100_percent = UserConfig::default();
-       config_100_percent.channel_handshake_config.announced_channel = true;
+       config_100_percent.channel_handshake_config.announce_for_forwarding = true;
        config_100_percent.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
 
        let chanmon_cfgs = create_chanmon_cfgs(4);
index f23e9fe1fc61ef105ac893fa630df0fa2706c03b..a4f87c1f6bdc505e097335c31000e51ba8970ca4 100644 (file)
@@ -1159,7 +1159,7 @@ mod test {
                // `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
                // is never handled, the `channel.counterparty.forwarding_info` is never assigned.
                let mut private_chan_cfg = UserConfig::default();
-               private_chan_cfg.channel_handshake_config.announced_channel = false;
+               private_chan_cfg.channel_handshake_config.announce_for_forwarding = false;
                let temporary_channel_id = nodes[2].node.create_channel(nodes[0].node.get_our_node_id(), 1_000_000, 500_000_000, 42, None, Some(private_chan_cfg)).unwrap();
                let open_channel = get_event_msg!(nodes[2], MessageSendEvent::SendOpenChannel, nodes[0].node.get_our_node_id());
                nodes[0].node.handle_open_channel(&nodes[2].node.get_our_node_id(), &open_channel);
@@ -1568,7 +1568,7 @@ mod test {
                // `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
                // is never handled, the `channel.counterparty.forwarding_info` is never assigned.
                let mut private_chan_cfg = UserConfig::default();
-               private_chan_cfg.channel_handshake_config.announced_channel = false;
+               private_chan_cfg.channel_handshake_config.announce_for_forwarding = false;
                let temporary_channel_id = nodes[1].node.create_channel(nodes[3].node.get_our_node_id(), 1_000_000, 500_000_000, 42, None, Some(private_chan_cfg)).unwrap();
                let open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[3].node.get_our_node_id());
                nodes[3].node.handle_open_channel(&nodes[1].node.get_our_node_id(), &open_channel);
index 3fbcef3449b2ea83a17cda9e3506105d4f1ac1a2..4efc2963db5674585003d1015ac1f42294bb3cf7 100644 (file)
@@ -2469,7 +2469,7 @@ fn test_yield_anchors_events() {
        let mut chanmon_cfgs = create_chanmon_cfgs(2);
        let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
        let mut anchors_config = test_default_channel_config();
-       anchors_config.channel_handshake_config.announced_channel = true;
+       anchors_config.channel_handshake_config.announce_for_forwarding = true;
        anchors_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
        anchors_config.manually_accept_inbound_channels = true;
        let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(anchors_config), Some(anchors_config)]);
@@ -2620,7 +2620,7 @@ fn test_anchors_aggregated_revoked_htlc_tx() {
        let bob_chain_monitor;
 
        let mut anchors_config = test_default_channel_config();
-       anchors_config.channel_handshake_config.announced_channel = true;
+       anchors_config.channel_handshake_config.announce_for_forwarding = true;
        anchors_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
        anchors_config.manually_accept_inbound_channels = true;
        let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(anchors_config), Some(anchors_config)]);
index 94c2cfd2ee412c7fcce38630be526242f72b8c50..0ddadd21614c8228022625111b25a5a8c23e9e22 100644 (file)
@@ -328,7 +328,7 @@ fn test_onion_failure() {
        // Channel::get_counterparty_htlc_minimum_msat().
        let mut node_2_cfg: UserConfig = test_default_channel_config();
        node_2_cfg.channel_handshake_config.our_htlc_minimum_msat = 2000;
-       node_2_cfg.channel_handshake_config.announced_channel = true;
+       node_2_cfg.channel_handshake_config.announce_for_forwarding = true;
        node_2_cfg.channel_handshake_limits.force_announced_channel_preference = false;
 
        // When this test was written, the default base fee floated based on the HTLC count.
@@ -754,13 +754,13 @@ fn test_overshoot_final_cltv() {
        claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage);
 }
 
-fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
+fn do_test_onion_failure_stale_channel_update(announce_for_forwarding: bool) {
        // Create a network of three nodes and two channels connecting them. We'll be updating the
        // HTLC relay policy of the second channel, causing forwarding failures at the first hop.
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = announced_channel;
+       config.channel_handshake_config.announce_for_forwarding = announce_for_forwarding;
        config.channel_handshake_limits.force_announced_channel_preference = false;
-       config.accept_forwards_to_priv_channels = !announced_channel;
+       config.accept_forwards_to_priv_channels = !announce_for_forwarding;
        config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FeeRateMultiplier(5_000_000 / 253);
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
@@ -773,7 +773,7 @@ fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
        let other_channel = create_chan_between_nodes(
                &nodes[0], &nodes[1],
        );
-       let channel_to_update = if announced_channel {
+       let channel_to_update = if announce_for_forwarding {
                let channel = create_announced_chan_between_nodes(
                        &nodes, 1, 2,
                );
@@ -790,7 +790,7 @@ fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
 
        // A test payment should succeed as the ChannelConfig has not been changed yet.
        const PAYMENT_AMT: u64 = 40000;
-       let (route, payment_hash, payment_preimage, payment_secret) = if announced_channel {
+       let (route, payment_hash, payment_preimage, payment_secret) = if announce_for_forwarding {
                get_route_and_payment_hash!(nodes[0], nodes[2], PAYMENT_AMT)
        } else {
                let hop_hints = vec![RouteHint(vec![RouteHintHop {
@@ -833,12 +833,12 @@ fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
                }
                let new_update = match &events[0] {
                        MessageSendEvent::BroadcastChannelUpdate { msg } => {
-                               assert!(announced_channel);
+                               assert!(announce_for_forwarding);
                                msg.clone()
                        },
                        MessageSendEvent::SendChannelUpdate { node_id, msg } => {
                                assert_eq!(node_id, channel_to_update_counterparty);
-                               assert!(!announced_channel);
+                               assert!(!announce_for_forwarding);
                                msg.clone()
                        },
                        _ => panic!("expected Broadcast/SendChannelUpdate event"),
@@ -1505,7 +1505,7 @@ fn do_test_phantom_dust_exposure_failure(multiplier_dust_limit: bool) {
        receiver_config.channel_config.max_dust_htlc_exposure =
                if multiplier_dust_limit { MaxDustHTLCExposure::FeeRateMultiplier(2) }
                else { MaxDustHTLCExposure::FixedLimitMsat(max_dust_exposure) };
-       receiver_config.channel_handshake_config.announced_channel = true;
+       receiver_config.channel_handshake_config.announce_for_forwarding = true;
 
        let chanmon_cfgs = create_chanmon_cfgs(2);
        let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
index a68f22ac9279de258bd3696da5353967fd42fa0e..83ff296e17727e7c7a6cfbb3031a040627a20867 100644 (file)
@@ -139,12 +139,12 @@ fn do_test_1_conf_open(connect_style: ConnectStyle) {
        // tests that we properly send one in that case.
        let mut alice_config = UserConfig::default();
        alice_config.channel_handshake_config.minimum_depth = 1;
-       alice_config.channel_handshake_config.announced_channel = true;
+       alice_config.channel_handshake_config.announce_for_forwarding = true;
        alice_config.channel_handshake_limits.force_announced_channel_preference = false;
        alice_config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FeeRateMultiplier(5_000_000 / 253);
        let mut bob_config = UserConfig::default();
        bob_config.channel_handshake_config.minimum_depth = 1;
-       bob_config.channel_handshake_config.announced_channel = true;
+       bob_config.channel_handshake_config.announce_for_forwarding = true;
        bob_config.channel_handshake_limits.force_announced_channel_preference = false;
        bob_config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FeeRateMultiplier(5_000_000 / 253);
        let chanmon_cfgs = create_chanmon_cfgs(2);
@@ -288,7 +288,7 @@ fn test_scid_privacy_on_pub_channel() {
        let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
        let mut scid_privacy_cfg = test_default_channel_config();
-       scid_privacy_cfg.channel_handshake_config.announced_channel = true;
+       scid_privacy_cfg.channel_handshake_config.announce_for_forwarding = true;
        scid_privacy_cfg.channel_handshake_config.negotiate_scid_privacy = true;
        nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(scid_privacy_cfg)).unwrap();
        let mut open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
@@ -312,7 +312,7 @@ fn test_scid_privacy_negotiation() {
        let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
        let mut scid_privacy_cfg = test_default_channel_config();
-       scid_privacy_cfg.channel_handshake_config.announced_channel = false;
+       scid_privacy_cfg.channel_handshake_config.announce_for_forwarding = false;
        scid_privacy_cfg.channel_handshake_config.negotiate_scid_privacy = true;
        nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(scid_privacy_cfg)).unwrap();
 
@@ -358,7 +358,7 @@ fn test_inbound_scid_privacy() {
        create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0);
 
        let mut no_announce_cfg = test_default_channel_config();
-       no_announce_cfg.channel_handshake_config.announced_channel = false;
+       no_announce_cfg.channel_handshake_config.announce_for_forwarding = false;
        no_announce_cfg.channel_handshake_config.negotiate_scid_privacy = true;
        nodes[1].node.create_channel(nodes[2].node.get_our_node_id(), 100_000, 10_000, 42, None, Some(no_announce_cfg)).unwrap();
        let mut open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[2].node.get_our_node_id());
@@ -591,7 +591,7 @@ fn test_0conf_channel_with_async_monitor() {
 
        create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0);
 
-       chan_config.channel_handshake_config.announced_channel = false;
+       chan_config.channel_handshake_config.announce_for_forwarding = false;
        nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None, Some(chan_config)).unwrap();
        let open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
 
@@ -758,7 +758,7 @@ fn test_0conf_close_no_early_chan_update() {
        let error_message = "Channel force-closed";
 
        // This is the default but we force it on anyway
-       chan_config.channel_handshake_config.announced_channel = true;
+       chan_config.channel_handshake_config.announce_for_forwarding = true;
        open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
 
        // We can use the channel immediately, but won't generate a channel_update until we get confs
@@ -782,7 +782,7 @@ fn test_public_0conf_channel() {
        let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
        // This is the default but we force it on anyway
-       chan_config.channel_handshake_config.announced_channel = true;
+       chan_config.channel_handshake_config.announce_for_forwarding = true;
        let (tx, ..) = open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
 
        // We can use the channel immediately, but we can't announce it until we get 6+ confirmations
@@ -836,7 +836,7 @@ fn test_0conf_channel_reorg() {
        let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
        // This is the default but we force it on anyway
-       chan_config.channel_handshake_config.announced_channel = true;
+       chan_config.channel_handshake_config.announce_for_forwarding = true;
        let (tx, ..) = open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
 
        // We can use the channel immediately, but we can't announce it until we get 6+ confirmations
@@ -1027,7 +1027,7 @@ fn test_0conf_ann_sigs_racing_conf() {
        let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
 
        // This is the default but we force it on anyway
-       chan_config.channel_handshake_config.announced_channel = true;
+       chan_config.channel_handshake_config.announce_for_forwarding = true;
        let (tx, ..) = open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
 
        // We can use the channel immediately, but we can't announce it until we get 6+ confirmations
index 0ba6e1259f5c341f5bed9ad6d5a726de5a43086f..3a92f02ccb552047794c9edcf2eabbe31e864e73 100644 (file)
@@ -728,7 +728,7 @@ fn test_upfront_shutdown_script() {
        // enforce it at shutdown message
 
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -902,7 +902,7 @@ fn test_invalid_upfront_shutdown_script() {
 #[test]
 fn test_segwit_v0_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -937,7 +937,7 @@ fn test_segwit_v0_shutdown_script() {
 #[test]
 fn test_anysegwit_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -972,7 +972,7 @@ fn test_anysegwit_shutdown_script() {
 #[test]
 fn test_unsupported_anysegwit_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -1015,7 +1015,7 @@ fn test_unsupported_anysegwit_shutdown_script() {
 #[test]
 fn test_invalid_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -1042,7 +1042,7 @@ fn test_invalid_shutdown_script() {
 #[test]
 fn test_user_shutdown_script() {
        let mut config = test_default_channel_config();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
@@ -1070,7 +1070,7 @@ fn test_user_shutdown_script() {
 #[test]
 fn test_already_set_user_shutdown_script() {
        let mut config = test_default_channel_config();
-       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_config.announce_for_forwarding = true;
        config.channel_handshake_limits.force_announced_channel_preference = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
index f369e793e9dfe8eaee2f7c4f86747f05a5b7a1f3..1c40aca87f310829a1bbedf17b33a955164b410e 100644 (file)
@@ -99,7 +99,7 @@ pub struct ChannelHandshakeConfig {
        /// private channel without that option.
        ///
        /// Ignored if the channel is negotiated to be announced, see
-       /// [`ChannelHandshakeConfig::announced_channel`] and
+       /// [`ChannelHandshakeConfig::announce_for_forwarding`] and
        /// [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
        ///
        /// Default value: `false` (This value is likely to change to `true` in the future.)
@@ -116,7 +116,7 @@ pub struct ChannelHandshakeConfig {
        /// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
        ///
        /// Default value: `false`
-       pub announced_channel: bool,
+       pub announce_for_forwarding: bool,
        /// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
        /// supports it, they will then enforce the mutual-close output to us matches what we provided
        /// at intialization, preventing us from closing to an alternate pubkey.
@@ -211,7 +211,7 @@ impl Default for ChannelHandshakeConfig {
                        our_htlc_minimum_msat: 1,
                        max_inbound_htlc_value_in_flight_percent_of_channel: 10,
                        negotiate_scid_privacy: false,
-                       announced_channel: false,
+                       announce_for_forwarding: false,
                        commit_upfront_shutdown_pubkey: true,
                        their_channel_reserve_proportional_millionths: 10_000,
                        negotiate_anchors_zero_fee_htlc_tx: false,
@@ -232,7 +232,7 @@ impl Readable for ChannelHandshakeConfig {
                        our_htlc_minimum_msat: Readable::read(reader)?,
                        max_inbound_htlc_value_in_flight_percent_of_channel: Readable::read(reader)?,
                        negotiate_scid_privacy: Readable::read(reader)?,
-                       announced_channel: Readable::read(reader)?,
+                       announce_for_forwarding: Readable::read(reader)?,
                        commit_upfront_shutdown_pubkey: Readable::read(reader)?,
                        their_channel_reserve_proportional_millionths: Readable::read(reader)?,
                        negotiate_anchors_zero_fee_htlc_tx: Readable::read(reader)?,
@@ -312,10 +312,10 @@ pub struct ChannelHandshakeLimits {
        /// Default value: `true`
        pub trust_own_funding_0conf: bool,
        /// Set to force an incoming channel to match our announced channel preference in
-       /// [`ChannelHandshakeConfig::announced_channel`].
+       /// [`ChannelHandshakeConfig::announce_for_forwarding`].
        ///
        /// For a node which is not online reliably, this should be set to true and
-       /// [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+       /// [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public)
        /// channels will ever be opened.
        ///
        /// Default value: `true`
@@ -693,14 +693,14 @@ impl From<ChannelConfig> for ChannelConfigUpdate {
 }
 
 /// Legacy version of [`ChannelConfig`] that stored the static
-/// [`ChannelHandshakeConfig::announced_channel`] and
+/// [`ChannelHandshakeConfig::announce_for_forwarding`] and
 /// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`] fields.
 #[derive(Copy, Clone, Debug)]
 pub(crate) struct LegacyChannelConfig {
        pub(crate) options: ChannelConfig,
-       /// Deprecated but may still be read from. See [`ChannelHandshakeConfig::announced_channel`] to
+       /// Deprecated but may still be read from. See [`ChannelHandshakeConfig::announce_for_forwarding`] to
        /// set this when opening/accepting a channel.
-       pub(crate) announced_channel: bool,
+       pub(crate) announce_for_forwarding: bool,
        /// Deprecated but may still be read from. See
        /// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`] to set this when
        /// opening/accepting a channel.
@@ -711,7 +711,7 @@ impl Default for LegacyChannelConfig {
        fn default() -> Self {
                Self {
                        options: ChannelConfig::default(),
-                       announced_channel: false,
+                       announce_for_forwarding: false,
                        commit_upfront_shutdown_pubkey: true,
                }
        }
@@ -728,7 +728,7 @@ impl crate::util::ser::Writeable for LegacyChannelConfig {
                        (1, max_dust_htlc_exposure_msat_fixed_limit, required),
                        (2, self.options.cltv_expiry_delta, required),
                        (3, self.options.force_close_avoidance_max_fee_satoshis, (default_value, 1000)),
-                       (4, self.announced_channel, required),
+                       (4, self.announce_for_forwarding, required),
                        (5, self.options.max_dust_htlc_exposure, required),
                        (6, self.commit_upfront_shutdown_pubkey, required),
                        (8, self.options.forwarding_fee_base_msat, required),
@@ -743,7 +743,7 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
                let mut max_dust_htlc_exposure_msat_fixed_limit = None;
                let mut cltv_expiry_delta = 0;
                let mut force_close_avoidance_max_fee_satoshis = 1000;
-               let mut announced_channel = false;
+               let mut announce_for_forwarding = false;
                let mut commit_upfront_shutdown_pubkey = false;
                let mut forwarding_fee_base_msat = 0;
                let mut max_dust_htlc_exposure_enum = None;
@@ -753,7 +753,7 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
                        (1, max_dust_htlc_exposure_msat_fixed_limit, option),
                        (2, cltv_expiry_delta, required),
                        (3, force_close_avoidance_max_fee_satoshis, (default_value, 1000u64)),
-                       (4, announced_channel, required),
+                       (4, announce_for_forwarding, required),
                        (5, max_dust_htlc_exposure_enum, option),
                        (6, commit_upfront_shutdown_pubkey, required),
                        (8, forwarding_fee_base_msat, required),
@@ -771,7 +771,7 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
                                forwarding_fee_base_msat,
                                accept_underpaying_htlcs: false,
                        },
-                       announced_channel,
+                       announce_for_forwarding,
                        commit_upfront_shutdown_pubkey,
                })
        }
@@ -794,7 +794,7 @@ pub struct UserConfig {
        /// node which is not online reliably.
        ///
        /// For nodes which are not online reliably, you should set all channels to *not* be announced
-       /// (using [`ChannelHandshakeConfig::announced_channel`] and
+       /// (using [`ChannelHandshakeConfig::announce_for_forwarding`] and
        /// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to `false` to
        /// ensure you are not exposed to any forwarding risk.
        ///