Skip to content

Commit

Permalink
fixed panic: runtime error: integer divide by zero prysmaticlabs#4777
Browse files Browse the repository at this point in the history
  • Loading branch information
aranhaagency committed Feb 10, 2020
1 parent 02b6d77 commit 483cbff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion beacon-chain/sync/pending_attestations_queue.go
Expand Up @@ -99,7 +99,9 @@ func (s *Service) processPendingAtts(ctx context.Context) error {

// Start with a random peer to query, but choose the first peer in our unsorted list that claims to
// have a head slot newer or equal to the pending attestation's target boundary slot.
pid := pids[rand.Int()%len(pids)]
if pid := pids[rand.Int()%len(pids)]; pid != 0; {
pid := pids[rand.Int()%len(pids)]
}
targetSlot := helpers.SlotToEpoch(attestations[0].Aggregate.Data.Target.Epoch)
for _, p := range pids {
if cs, _ := s.p2p.Peers().ChainState(p); cs != nil && cs.HeadSlot >= targetSlot {
Expand Down

0 comments on commit 483cbff

Please sign in to comment.