]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Don't advertise onion messages in known channel features
authorValentine Wallace <vwallace@protonmail.com>
Fri, 9 Sep 2022 16:41:23 +0000 (12:41 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Fri, 9 Sep 2022 20:00:26 +0000 (16:00 -0400)
lightning/src/ln/features.rs

index 34dd28337215e1413f557a8ed1dc0e4497d180a3..642298f56ed52265952eb2b4642163a06f5b0474 100644 (file)
@@ -559,13 +559,16 @@ impl InitFeatures {
                Self::known()
                        .clear_initial_routing_sync()
                        .clear_gossip_queries()
+                       .clear_onion_messages()
        }
 }
 
 impl NodeFeatures {
        /// Returns the set of known node features that are related to channels.
        pub fn known_channel_features() -> NodeFeatures {
-               Self::known().clear_gossip_queries()
+               Self::known()
+                       .clear_gossip_queries()
+                       .clear_onion_messages()
        }
 }
 
@@ -799,6 +802,13 @@ impl<T: sealed::InitialRoutingSync> Features<T> {
        }
 }
 
+impl<T: sealed::OnionMessages> Features<T> {
+       pub(crate) fn clear_onion_messages(mut self) -> Self {
+               <T as sealed::OnionMessages>::clear_bits(&mut self.flags);
+               self
+       }
+}
+
 impl<T: sealed::ShutdownAnySegwit> Features<T> {
        #[cfg(test)]
        pub(crate) fn clear_shutdown_anysegwit(mut self) -> Self {