Skip to content

Commit

Permalink
Merge pull request #129 from ethpandaops/pk910/fix-nil-panic
Browse files Browse the repository at this point in the history
fix nil pointer panic in finalization routine
  • Loading branch information
pk910 authored Sep 18, 2024
2 parents 1b8b7c2 + f94f530 commit 8732546
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion indexer/beacon/finalization.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@ func (indexer *Indexer) finalizeEpoch(epoch phase0.Epoch, justifiedRoot phase0.R
// persist orphaned blocks
for _, block := range orphanedBlocks {
dependentBlock := indexer.blockCache.getDependentBlock(chainState, block, client)
epochStats := indexer.epochCache.getEpochStats(epoch, dependentBlock.Root)

var epochStats *EpochStats
if dependentBlock != nil {
epochStats = indexer.epochCache.getEpochStats(epoch, dependentBlock.Root)
}

if _, err := indexer.dbWriter.persistBlockData(tx, block, epochStats, nil, true, nil); err != nil {
return fmt.Errorf("failed persisting orphaned slot %v (%v): %v", block.Slot, block.Root.String(), err)
Expand Down

0 comments on commit 8732546

Please sign in to comment.