Fix panic when fetching block in case of reorg (#1259)

This commit is contained in:
Pratik Patil 2024-06-06 10:59:45 +05:30 committed by GitHub
parent a0acefc04c
commit c0d1fbb86a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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())