Commit c9d5a1f
authored
fix new chain not using configured reorg check start block (#173)
### TL;DR
Fixed reorg handler logic to properly handle cases where the configured start block is ahead of the latest committed block.
### What changed?
- Refactored `getInitialCheckedBlockNumber` function to improve readability by using more descriptive variable names and restructuring the conditional logic
- Added a new check in `getReorgCheckRange` to handle the case where the latest checked block is ahead of the latest committed block, preventing unnecessary processing
### How to test?
1. Configure a reorg handler with a start block that is ahead of the latest committed block
2. Verify that the reorg handler logs the message "Committing has not reached the configured reorg check start block" and continues without error
3. Confirm that the reorg handler correctly uses the configured block when appropriate based on the ForceFromBlock setting
### Why make this change?
This change prevents the reorg handler from attempting to process blocks that haven't been committed yet, which could lead to errors or unexpected behavior. The refactoring also improves code readability and maintainability by using clearer variable names and more logical flow.1 file changed
+20
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
| |||
0 commit comments