-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip unmerged blocks in reorg handler (#111)
### TL;DR Added support for handling duplicate blocks during chain reorganization detection. ### What changed? - Added a check in `findReorgEndIndex` to skip blocks with the same block number during reorg detection - Added test cases to verify handling of duplicate blocks and correct block sequences - Improved reorg detection logic to handle unmerged blocks in the chain ### How to test? 1. Run the new test cases: - `TestHandleReorgWithDuplicateBlocks` - `TestNothingIsDoneForCorrectBlocks` 2. Verify that duplicate blocks are properly handled and don't trigger false reorg detections 3. Confirm that correct block sequences continue to work as expected ### Why make this change? When processing block headers, duplicate blocks with the same block number can appear if there are multiple committers running by mistake. Usually clickhouse will merge these duplicates in the background, but these duplicates should not trigger reorg handling, as they represent unmerged blocks rather than actual chain reorganizations. This change ensures more accurate reorg detection by properly handling these edge cases.
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters