From: Matt Corallo Date: Wed, 7 Sep 2022 17:43:14 +0000 (+0000) Subject: Make clear_initial_routing_sync more consistent with other APIs X-Git-Tag: v0.0.111~9^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=1b67b0b0564e257414226d887520def1217f83be;p=rust-lightning Make clear_initial_routing_sync more consistent with other APIs --- 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()); }