]> Untitled Git - bdk/commitdiff
fix(chain): correct `Iterator::size_hint` impl
author志宇 <hello@evanlinjin.me>
Mon, 12 Aug 2024 04:02:19 +0000 (04:02 +0000)
committer志宇 <hello@evanlinjin.me>
Wed, 14 Aug 2024 08:16:58 +0000 (08:16 +0000)
crates/chain/src/spk_client.rs

index 9ede0a93a267b60b5d510e14f67b07ad1ff72dd4..9a57a684457c8cc03acd731ba0a2d4a72cbb9baf 100644 (file)
@@ -557,8 +557,8 @@ impl<'r, I> Iterator for SyncIter<'r, I, ScriptBuf> {
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        let consumed = self.request.spks_consumed;
-        (consumed, Some(consumed))
+        let remaining = self.request.spks.len();
+        (remaining, Some(remaining))
     }
 }
 
@@ -570,8 +570,8 @@ impl<'r, I> Iterator for SyncIter<'r, I, Txid> {
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        let consumed = self.request.txids_consumed;
-        (consumed, Some(consumed))
+        let remaining = self.request.txids.len();
+        (remaining, Some(remaining))
     }
 }
 
@@ -583,7 +583,7 @@ impl<'r, I> Iterator for SyncIter<'r, I, OutPoint> {
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        let consumed = self.request.outpoints_consumed;
-        (consumed, Some(consumed))
+        let remaining = self.request.outpoints.len();
+        (remaining, Some(remaining))
     }
 }