Add a new NodeFeatures constructor to capture the types of flags
[rust-lightning] / lightning / src / ln / features.rs
index a680d0184e7601502763dcdb68824ad97342e545..ceb78a4a0d23678ecb26f3aef1da4b42bffe3da9 100644 (file)
@@ -164,7 +164,8 @@ mod sealed {
                ],
                optional_features: [
                        // Note that if new "non-channel-related" flags are added here they should be
-                       // explicitly cleared in InitFeatures::known_channel_features.
+                       // explicitly cleared in InitFeatures::known_channel_features and
+                       // NodeFeatures::known_channel_features.
                        // Byte 0
                        DataLossProtect | InitialRoutingSync | UpfrontShutdownScript | GossipQueries,
                        // Byte 1
@@ -558,6 +559,13 @@ impl InitFeatures {
        }
 }
 
+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()
+       }
+}
+
 impl InvoiceFeatures {
        /// Converts `InvoiceFeatures` to `Features<C>`. Only known `InvoiceFeatures` relevant to
        /// context `C` are included in the result.