Skip to content

Commit

Permalink
Fix panic when fetching block in case of reorg (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikspatil024 authored Jun 6, 2024
1 parent a0acefc commit c0d1fbb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ethstats/ethstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,12 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
}
}

// It's weird, but it's possible that the block is nil here.
// even though the check for error is done above.
if block == nil {
return nil
}

header = block.Header()
td = fullBackend.GetTd(context.Background(), header.Hash())

Expand Down

0 comments on commit c0d1fbb

Please sign in to comment.