From f20907d5970f1720e35e63401897fabc850b10bf Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 28 Apr 2026 11:11:58 -0300 Subject: [PATCH] feat: is_self_addr(): Employ the config cache to optimize for ConfiguredAddr passed --- src/config.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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?