Skip to content

Commit 27da4d8

Browse files
committed
cleaner reorg logic
1 parent b7a675e commit 27da4d8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/block_range_scanner.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,15 +589,12 @@ impl<N: Network> Service<N> {
589589
// TODO: should we send the incoming block range or incoming block num -
590590
// reorg depth? The incoming block should be the
591591
// latest block from the reorg point so no real need
592-
if sender.send(Ok(incoming_block_num..=incoming_block_num)).await.is_err() {
593-
warn!("Downstream channel closed, stopping live blocks task (reorg)");
594-
return;
595-
}
596-
} else if sender
597-
.send(Ok(expected_next_block..=incoming_block_num))
598-
.await
599-
.is_err()
600-
{
592+
593+
// resets cursor to incoming block num
594+
expected_next_block = incoming_block_num;
595+
}
596+
597+
if sender.send(Ok(expected_next_block..=incoming_block_num)).await.is_err() {
601598
warn!("Downstream channel closed, stopping live blocks task");
602599
return;
603600
}

0 commit comments

Comments
 (0)