From 7d34480ee2265cf56c183f588108dd3eba854f73 Mon Sep 17 00:00:00 2001 From: valued mammal Date: Mon, 23 Sep 2024 08:41:19 -0400 Subject: [PATCH] fix(rpc): FilterIter returns None if spks is empty --- crates/bitcoind_rpc/src/bip158.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bitcoind_rpc/src/bip158.rs b/crates/bitcoind_rpc/src/bip158.rs index bb2bd1775..78278bcc6 100644 --- a/crates/bitcoind_rpc/src/bip158.rs +++ b/crates/bitcoind_rpc/src/bip158.rs @@ -177,6 +177,10 @@ impl<'c, C: RpcApi> Iterator for FilterIter<'c, C> { type Item = Result; fn next(&mut self) -> Option { + if self.spks.is_empty() { + return None; + } + let (block, filter) = self.next_filter.clone()?; (|| -> Result<_, Error> { @@ -184,9 +188,7 @@ impl<'c, C: RpcApi> Iterator for FilterIter<'c, C> { // and return it, inserting relevant block ids along the way let height = block.height; let hash = block.hash; - let event = if self.spks.is_empty() { - Event::NoMatch(height) - } else if filter + let event = if filter .match_any(&hash, self.spks.iter().map(|script| script.as_bytes())) .map_err(Error::Bip158)? {