Skip to content

Commit 5a75c64

Browse files
committed
minor change
1 parent 2a808a8 commit 5a75c64

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/committer/reorg.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)