File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -182,16 +182,17 @@ func detectAndHandleReorgs(startBlock int64, endBlock int64) error {
182182 }
183183 }
184184
185+ lastValidBlock := lastHeaderBlock
185186 if finalStart > - 1 {
186187 // We found at least one inconsistent range; reorg from min(start) to max(end).
187188 if err := handleReorgForRange (uint64 (finalStart ), uint64 (finalEnd )); err != nil {
188189 return err
189190 }
190- libs . SetReorgLastValidBlock ( libs . ChainIdStr , finalEnd )
191- } else {
192- // No inconsistencies across blocks, transactions, or logs; mark the last checked
193- // header block as the last valid block.
194- libs . SetReorgLastValidBlock ( libs . ChainIdStr , lastHeaderBlock )
191+ lastValidBlock = finalEnd
192+ }
193+ err = libs . SetReorgLastValidBlock ( libs . ChainIdStr , lastValidBlock )
194+ if err != nil {
195+ return fmt . Errorf ( "detectAndHandleReorgs: failed to set last valid block: %w" , err )
195196 }
196197
197198 return nil
You can’t perform that action at this time.
0 commit comments