From c0d1fbb86a99668cff01d7ff5d482792d8c4fc36 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Thu, 6 Jun 2024 10:59:45 +0530 Subject: [PATCH] Fix panic when fetching block in case of reorg (#1259) --- ethstats/ethstats.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index 8484477c1c..4c3650304c 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -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())