diff --git a/src/config.rs b/src/config.rs index 305e8765c..6221c035f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -944,6 +944,18 @@ impl Context { /// Determine whether the specified addr maps to the/a self addr. /// Returns `false` if no addresses are configured. pub(crate) async fn is_self_addr(&self, addr: &str) -> Result { + // Employ the config cache to optimize for `ConfiguredAddr` passed. + if !addr.is_empty() + && addr_cmp( + addr, + &self + .get_config(Config::ConfiguredAddr) + .await? + .unwrap_or_default(), + ) + { + return Ok(true); + } Ok(self .get_all_self_addrs() .await?