From 29e4f459a578786ff36e70d48a350928f1fb3788 Mon Sep 17 00:00:00 2001 From: axiomatic-aardvark Date: Thu, 1 Feb 2024 17:57:15 +0200 Subject: [PATCH] feat: allow content topic matching when topic list is empty --- src/graphcast_agent/waku_handling.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/graphcast_agent/waku_handling.rs b/src/graphcast_agent/waku_handling.rs index 18c68f0..74dec71 100644 --- a/src/graphcast_agent/waku_handling.rs +++ b/src/graphcast_agent/waku_handling.rs @@ -449,13 +449,15 @@ pub fn handle_signal( } } -/// Check if a content topic exists in a list of topics +/// Check if a content topic exists in a list of topics or if the list is empty pub fn match_content_topic( content_topics: &Arc>>, topic: &WakuContentTopic, ) -> bool { trace!(topic = tracing::field::debug(topic), "Target content topic"); - content_topics.lock().unwrap().iter().any(|t| t == topic) + + let locked_topics = content_topics.lock().unwrap(); + locked_topics.is_empty() || locked_topics.iter().any(|t| t == topic) } #[derive(Debug, thiserror::Error)]