Skip to content

Commit 658ff93

Browse files
committed
remove rewind
1 parent fcc534c commit 658ff93

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/block_range_scanner.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,9 @@ impl<N: Network> Service<N> {
412412
return Err(BlockRangeScannerError::ServiceShutdown);
413413
};
414414

415-
let reorg_rewind = self.config.reorg_rewind_depth;
416415
let block_confirmations = self.config.block_confirmations;
417416
tokio::spawn(async move {
418-
Self::stream_live_blocks(start, provider, sender, reorg_rewind, block_confirmations)
419-
.await;
417+
Self::stream_live_blocks(start, provider, sender, block_confirmations).await;
420418
});
421419

422420
Ok(())
@@ -492,7 +490,6 @@ impl<N: Network> Service<N> {
492490
// Any block > cutoff will come from the live stream
493491
let cutoff = end_block.header().number();
494492

495-
let reorg_rewind = self.config.reorg_rewind_depth;
496493
let block_confirmations = self.config.block_confirmations;
497494

498495
// This task runs independently, accumulating new blocks while wehistorical data is syncing
@@ -501,7 +498,6 @@ impl<N: Network> Service<N> {
501498
cutoff + 1,
502499
provider,
503500
live_block_buffer_sender,
504-
reorg_rewind,
505501
block_confirmations,
506502
)
507503
.await;
@@ -580,7 +576,6 @@ impl<N: Network> Service<N> {
580576
mut expected_next_block: BlockNumber,
581577
provider: P,
582578
sender: mpsc::Sender<BlockRangeMessage>,
583-
_reorg_rewind_depth: u64,
584579
block_confirmations: u64,
585580
) {
586581
match Self::get_block_subscription(&provider).await {
@@ -1176,6 +1171,10 @@ mod tests {
11761171
}
11771172
assert!(reorg_detected, "Reorg should have been detected");
11781173

1174+
// Generally check that there is a reorg in the range i.e.
1175+
// REORG
1176+
// [0..=0, 1..=1, 2..=2, 3..=3, 4..=4, 5..=5, 6..=6, 7..=7, 3..=3, 4..=4, 5..=5, 6..=6,
1177+
// 7..=7, 8..=8, 9..=9] (Less flaky to assert this way)
11791178
let mut found_reorg_pattern = false;
11801179
for window in block_num.windows(2) {
11811180
if window[1].start() < window[0].end() {

0 commit comments

Comments
 (0)