@@ -96,23 +96,10 @@ impl<N: Network> EventScannerService<N> {
9696
9797 /// Implementation of stream live
9898 ///
99- /// Selects live, historical, or historical→live mode based on `start_height`/`end_height`.
100- ///
101- /// # Arguments
102- ///
103- /// * `start_height` - Start block (tag or number).
104- /// * `end_height` - Optional end block (tag or number). If `Some`, a historical scan is
105- /// performed over the inclusive range; if `None`, the scanner either streams live or performs
106- /// historical→live depending on `start_height`.
107- ///
10899 /// # Reorg behavior
109100 ///
110- /// * Historical: verifies chain continuity and if a reorg is detected, rewinds to the
111- /// appropriate post-reorg block, then continues forward.
112- /// * Live: on reorg, emits [`ScannerStatus::ReorgDetected`] and adjusts the next block range
113- /// using `with_block_confirmations` to re-emit the confirmed portion.
114- /// * Historical → Live: reorgs are handled as per the particular mode the scanner is in
115- /// (historical or live).
101+ /// * Emits [`ScannerStatus::ReorgDetected`] and adjusts the next block range using
102+ /// `block_confirmations` to re-emit the confirmed portion.
116103 ///
117104 /// # Errors
118105 ///
@@ -344,108 +331,3 @@ impl<N: Network> EventScannerService<N> {
344331 self . event_listeners . push ( event_listener) ;
345332 }
346333}
347-
348- // pub struct Client<N: Network> {
349- // event_scanner: ConnectedEventScanner<N>,
350- // }
351- //
352- // impl<N: Network> Client<N> {
353- // pub fn create_event_stream(
354- // &mut self,
355- // event_filter: EventFilter,
356- // ) -> ReceiverStream<EventScannerMessage> {
357- // let (sender, receiver) = mpsc::channel::<EventScannerMessage>(MAX_BUFFERED_MESSAGES);
358- //
359- // self.event_scanner.add_event_listener(EventListener { filter: event_filter, sender });
360- //
361- // ReceiverStream::new(receiver)
362- // }
363- //
364- // /// Starts the scanner
365- // ///
366- // /// Selects live, historical, or historical→live mode based on `start_height`/`end_height`.
367- // ///
368- // /// # Arguments
369- // ///
370- // /// * `start_height` - Start block (tag or number).
371- // /// * `end_height` - Optional end block (tag or number). If `Some`, a historical scan is
372- // /// performed over the inclusive range; if `None`, the scanner either streams live or
373- // performs /// historical→live depending on `start_height`.
374- // ///
375- // /// # Reorg behavior
376- // ///
377- // /// * Historical: No reorg detection still WIP.
378- // /// * Live: emits [`ScannerStatus::ReorgDetected`] and adjusts the confirmed range using
379- // /// `with_block_confirmations` (re-emits confirmed portions as needed).
380- // /// * Historical → Live: reorgs are handled as per the particular mode the scanner is in
381- // /// (historical or live).
382- // ///
383- // /// # Errors
384- // ///
385- // /// Returns an error if the scanner fails to start
386- // ///
387- // /// [`ScannerStatus::ReorgDetected`]: crate::types::ScannerStatus::ReorgDetected
388- // pub async fn start_scanner<T: Into<BlockNumberOrTag>>(
389- // self,
390- // start_height: T,
391- // end_height: Option<T>,
392- // ) -> Result<(), EventScannerError> {
393- // self.event_scanner.start(start_height.into(), end_height.map(Into::into)).await
394- // }
395- //
396- // /// Scans the chain and collects the latest `count` events per registered listener.
397- // ///
398- // /// Internally calls `scan_latest_in_range` with `Earliest..=Latest` and emits a single
399- // message /// per listener with up to `count` logs, chronologically ordered.
400- // ///
401- // /// # Reorg behavior
402- // ///
403- // /// Same as `scan_latest_in_range` over the full chain; reorgs during rewind are detected,
404- // /// [`ScannerStatus::ReorgDetected`] is emitted, and the reorg is handled by restarting from
405- // /// the updated tip.
406- // ///
407- // /// # Arguments
408- // ///
409- // /// * `count` - Maximum number of events to return per listener.
410- // ///
411- // /// # Errors
412- // ///
413- // /// * Returns `EventScannerError` if the scan fails to start or fetching logs fails.
414- // ///
415- // /// [`ScannerStatus::ReorgDetected`]: crate::types::ScannerStatus::ReorgDetected
416- // pub async fn scan_latest(self, count: usize) -> Result<(), EventScannerError> {
417- // self.event_scanner
418- // .scan_latest(count, BlockNumberOrTag::Earliest, BlockNumberOrTag::Latest)
419- // .await
420- // }
421- //
422- // /// Scans within the provided block range and collects the latest `count` events per
423- // registered /// listener.
424- // ///
425- // /// Emits a single message per listener with up to `count` logs, chronologically ordered.
426- // ///
427- // /// # Arguments
428- // ///
429- // /// * `count` - Maximum number of events to return per listener.
430- // /// * `start_height` - Inclusive start block (tag or number).
431- // /// * `end_height` - Inclusive end block (tag or number).
432- // ///
433- // /// # Reorg behavior
434- // ///
435- // /// Reverse-ordered rewind over the range with periodic tip checks. On reorg, emits
436- // /// [`ScannerStatus::ReorgDetected`], resets the rewind start to the updated tip, and
437- // resumes. ///
438- // /// # Errors
439- // ///
440- // /// * Returns `EventScannerError` if the scan fails to start or fetching logs fails.
441- // ///
442- // /// [`ScannerStatus::ReorgDetected`]: crate::types::ScannerStatus::ReorgDetected
443- // pub async fn scan_latest_in_range<T: Into<BlockNumberOrTag>>(
444- // self,
445- // count: usize,
446- // start_height: T,
447- // end_height: T,
448- // ) -> Result<(), EventScannerError> {
449- // self.event_scanner.scan_latest(count, start_height, end_height).await
450- // }
451- // }
0 commit comments