Skip to content

Commit 9611c8d

Browse files
authored
Merge pull request #105 from ethpandaops/bbusa/fix-panic
fix: panic for nil pointer dereference runRangeCheck
2 parents e207c35 + 69a4b7d commit 9611c8d

File tree

1 file changed

+9
-2
lines changed
  • pkg/coordinator/tasks/check_consensus_slot_range

1 file changed

+9
-2
lines changed

pkg/coordinator/tasks/check_consensus_slot_range/task.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ func (t *Task) Execute(ctx context.Context) error {
9999

100100
func (t *Task) runRangeCheck() (checkResult, isLower bool) {
101101
consensusPool := t.ctx.Scheduler.GetServices().ClientPool().GetConsensusPool()
102-
if consensusPool.GetBlockCache().GetGenesis().GenesisTime.Compare(time.Now()) >= 0 {
102+
genesis := consensusPool.GetBlockCache().GetGenesis()
103+
104+
if genesis == nil {
105+
t.logger.Errorf("genesis data not available")
106+
return false, true
107+
}
108+
109+
if genesis.GenesisTime.Compare(time.Now()) >= 0 {
103110
return false, true
104111
}
105112

@@ -109,7 +116,7 @@ func (t *Task) runRangeCheck() (checkResult, isLower bool) {
109116
return false, true
110117
}
111118

112-
t.ctx.Outputs.SetVar("genesisTime", consensusPool.GetBlockCache().GetGenesis().GenesisTime.Unix())
119+
t.ctx.Outputs.SetVar("genesisTime", genesis.GenesisTime.Unix())
113120
t.ctx.Outputs.SetVar("currentSlot", currentSlot.Number())
114121
t.ctx.Outputs.SetVar("currentEpoch", currentEpoch.Number())
115122

0 commit comments

Comments
 (0)