From 1b67b0b0564e257414226d887520def1217f83be Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 7 Sep 2022 17:43:14 +0000 Subject: [PATCH] Make clear_initial_routing_sync more consistent with other APIs --- lightning/src/ln/features.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index e5e9db035..91922f1a4 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -551,9 +551,9 @@ impl InitFeatures { /// Returns the set of known init features that are related to channels. At least some of /// these features are likely required for peers to talk to us. pub fn known_channel_features() -> InitFeatures { - let mut features = Self::known().clear_gossip_queries(); - features.clear_initial_routing_sync(); - features + Self::known() + .clear_initial_routing_sync() + .clear_gossip_queries() } } @@ -781,8 +781,9 @@ impl Features { impl Features { // Note that initial_routing_sync is ignored if gossip_queries is set. - pub(crate) fn clear_initial_routing_sync(&mut self) { - ::clear_bits(&mut self.flags) + pub(crate) fn clear_initial_routing_sync(mut self) -> Self { + ::clear_bits(&mut self.flags); + self } } @@ -921,7 +922,7 @@ mod tests { let mut init_features = InitFeatures::known(); assert!(init_features.initial_routing_sync()); - init_features.clear_initial_routing_sync(); + init_features = init_features.clear_initial_routing_sync(); assert!(!init_features.initial_routing_sync()); } -- 2.39.5