Skip to content

Commit

Permalink
Check batchProcessed > 0 to avoid underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi committed Nov 20, 2024
1 parent 387ac79 commit 3b07fcc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions arbnode/sync_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ func (s *SyncMonitor) FullSyncProgressMap() map[string]interface{} {
batchProcessed := s.inboxReader.GetLastReadBatchCount()
res["batchProcessed"] = batchProcessed

processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
if err != nil {
res["batchMetadataError"] = err.Error()
} else {
res["messageOfProcessedBatch"] = processedBatchMsgs
if batchProcessed > 0 {
processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
if err != nil {
res["batchMetadataError"] = err.Error()
} else {
res["messageOfProcessedBatch"] = processedBatchMsgs
}
}

l1reader := s.inboxReader.l1Reader
Expand Down

0 comments on commit 3b07fcc

Please sign in to comment.