Skip to content

Commit 0f10b55

Browse files
committed
feat(core)!: Remove redundant SyncRequest methods
Methods `next_spk` and `iter_spks` are removed. These are superceded with `next_spk_with_expected_txids` and `iter_spks_with_expected_txids`.
1 parent aca7286 commit 0f10b55

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

crates/core/src/spk_client.rs

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,14 @@ impl<I> SyncRequest<I> {
320320
self.chain_tip.clone()
321321
}
322322

323-
/// Advances the sync request and returns the next [`ScriptBuf`].
324-
///
325-
/// Returns [`None`] when there are no more scripts remaining in the request.
326-
pub fn next_spk(&mut self) -> Option<ScriptBuf> {
327-
let (i, spk) = self.spks.pop_front()?;
328-
self.spks_consumed += 1;
329-
self._call_inspect(SyncItem::Spk(i, spk.as_script()));
330-
Some(spk)
331-
}
332-
333323
/// Advances the sync request and returns the next [`ScriptBuf`] with corresponding [`Txid`]
334324
/// history.
335325
///
336326
/// Returns [`None`] when there are no more scripts remaining in the request.
337327
pub fn next_spk_with_expected_txids(&mut self) -> Option<SpkWithExpectedTxids> {
338-
let next_spk = self.next_spk()?;
328+
let (i, next_spk) = self.spks.pop_front()?;
329+
self.spks_consumed += 1;
330+
self._call_inspect(SyncItem::Spk(i, next_spk.as_script()));
339331
let spk_history = self
340332
.spk_expected_txids
341333
.get(&next_spk)
@@ -367,11 +359,6 @@ impl<I> SyncRequest<I> {
367359
Some(outpoint)
368360
}
369361

370-
/// Iterate over [`ScriptBuf`]s contained in this request.
371-
pub fn iter_spks(&mut self) -> impl ExactSizeIterator<Item = ScriptBuf> + '_ {
372-
SyncIter::<I, ScriptBuf>::new(self)
373-
}
374-
375362
/// Iterate over [`ScriptBuf`]s with corresponding [`Txid`] histories contained in this request.
376363
pub fn iter_spks_with_expected_txids(
377364
&mut self,
@@ -605,19 +592,6 @@ impl<'r, I, Item> SyncIter<'r, I, Item> {
605592

606593
impl<'r, I, Item> ExactSizeIterator for SyncIter<'r, I, Item> where SyncIter<'r, I, Item>: Iterator {}
607594

608-
impl<I> Iterator for SyncIter<'_, I, ScriptBuf> {
609-
type Item = ScriptBuf;
610-
611-
fn next(&mut self) -> Option<Self::Item> {
612-
self.request.next_spk()
613-
}
614-
615-
fn size_hint(&self) -> (usize, Option<usize>) {
616-
let remaining = self.request.spks.len();
617-
(remaining, Some(remaining))
618-
}
619-
}
620-
621595
impl<I> Iterator for SyncIter<'_, I, SpkWithExpectedTxids> {
622596
type Item = SpkWithExpectedTxids;
623597

0 commit comments

Comments
 (0)