From 01c4fe54cb6e4d771c09aaf323f08d66e1e8a281 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Wed, 18 Dec 2024 15:03:42 -1000 Subject: [PATCH] fix(filters): remove unnecessary `async` --- example/managed.rs | 2 +- src/chain/chain.rs | 1 - src/filters/mod.rs | 5 +---- src/lib.rs | 3 +-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/example/managed.rs b/example/managed.rs index 1b7e469..d37bcf7 100644 --- a/example/managed.rs +++ b/example/managed.rs @@ -63,7 +63,7 @@ async fn main() { tracing::info!("Connected to all required peers"); } NodeMessage::IndexedFilter(mut filter) => { - if filter.contains_any(&addresses).await { + if filter.contains_any(&addresses) { let hash = *filter.block_hash(); tracing::info!("Found script at {}!", hash); let indexed_block = client.get_block(hash).await.unwrap(); diff --git a/src/chain/chain.rs b/src/chain/chain.rs index db2c732..ff8a81f 100644 --- a/src/chain/chain.rs +++ b/src/chain/chain.rs @@ -768,7 +768,6 @@ impl Chain { if !self.block_queue.contains(&filter_message.block_hash) && filter .contains_any(&self.scripts) - .await .map_err(CFilterSyncError::Filter)? { // Add to the block queue diff --git a/src/filters/mod.rs b/src/filters/mod.rs index 47fae28..e4d82e2 100644 --- a/src/filters/mod.rs +++ b/src/filters/mod.rs @@ -42,10 +42,7 @@ impl Filter { &self.block_hash } - pub async fn contains_any( - &mut self, - scripts: &HashSet, - ) -> Result { + pub fn contains_any(&mut self, scripts: &HashSet) -> Result { self.block_filter .match_any( &self.block_hash, diff --git a/src/lib.rs b/src/lib.rs index ce1b858..720ecf8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -205,10 +205,9 @@ impl IndexedFilter { } /// Does the filter contain a positive match for any of the provided scripts - pub async fn contains_any(&mut self, scripts: &HashSet) -> bool { + pub fn contains_any(&mut self, scripts: &HashSet) -> bool { self.filter .contains_any(scripts) - .await .expect("vec reader is infallible") } }