Skip to content

Commit d36f710

Browse files
committed
doc: move doc to public api
1 parent 5f65fe1 commit d36f710

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/block_range_scanner.rs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -442,17 +442,6 @@ impl<N: Network> Service<N> {
442442
}
443443

444444
/// Streams blocks in reverse order from `from` to `to`.
445-
///
446-
/// The `from` block is assumed to be greater than or equal to the `to` block.
447-
///
448-
/// # Reorg Handling
449-
///
450-
/// Reorg checks are only performed when the tip is above the current finalized
451-
/// block height.
452-
///
453-
/// # Errors
454-
///
455-
/// Returns an error if the stream fails
456445
async fn stream_rewind(
457446
from: N::BlockResponse,
458447
to: N::BlockResponse,
@@ -700,10 +689,31 @@ impl BlockRangeScannerClient {
700689

701690
/// Streams blocks in reverse order from `start_id` to `end_id`.
702691
///
692+
/// The `start_id` block is assumed to be greater than or equal to the `end_id` block.
693+
/// Blocks are streamed in batches, where each batch is ordered from lower to higher
694+
/// block numbers (chronological order within each batch), but batches themselves
695+
/// progress from newer to older blocks.
696+
///
703697
/// # Arguments
704698
///
705-
/// * `start_id` - The starting block id (defaults to Latest if None).
706-
/// * `end_id` - The ending block id (defaults to Earliest if None).
699+
/// * `start_id` - The starting block id (higher block number).
700+
/// * `end_id` - The ending block id (lower block number).
701+
///
702+
/// # Reorg Handling
703+
///
704+
/// Reorg checks are only performed when the starting block (`start_id`) is above the
705+
/// current finalized block height. When a reorg is detected:
706+
///
707+
/// 1. A [`Notification::ReorgDetected`][reorg] is emitted with the common ancestor block
708+
/// 2. The scanner fetches the new tip block at the same height
709+
/// 3. Reorged blocks are re-streamed in chronological order (from `common_ancestor + 1`
710+
/// up to the new tip)
711+
/// 4. The reverse scan continues from where it left off
712+
///
713+
/// If the starting block is at or below the finalized block, no reorg checks are
714+
/// performed since finalized blocks cannot be reorganized.
715+
///
716+
/// [reorg]: crate::Notification::ReorgDetected
707717
///
708718
/// # Errors
709719
///

0 commit comments

Comments
 (0)