Skip to content

Commit 7d34480

Browse files
committed
fix(rpc): FilterIter returns None if spks is empty
1 parent 881bf3d commit 7d34480

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/bitcoind_rpc/src/bip158.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,18 @@ impl<'c, C: RpcApi> Iterator for FilterIter<'c, C> {
177177
type Item = Result<Event, Error>;
178178

179179
fn next(&mut self) -> Option<Self::Item> {
180+
if self.spks.is_empty() {
181+
return None;
182+
}
183+
180184
let (block, filter) = self.next_filter.clone()?;
181185

182186
(|| -> Result<_, Error> {
183187
// if the next filter matches any of our watched spks, get the block
184188
// and return it, inserting relevant block ids along the way
185189
let height = block.height;
186190
let hash = block.hash;
187-
let event = if self.spks.is_empty() {
188-
Event::NoMatch(height)
189-
} else if filter
191+
let event = if filter
190192
.match_any(&hash, self.spks.iter().map(|script| script.as_bytes()))
191193
.map_err(Error::Bip158)?
192194
{

0 commit comments

Comments
 (0)