From 483cbff96368f32e48a57da870e77da9d6cef24e Mon Sep 17 00:00:00 2001 From: Aranha Date: Mon, 10 Feb 2020 21:50:49 +0000 Subject: [PATCH] fixed panic: runtime error: integer divide by zero #4777 --- beacon-chain/sync/pending_attestations_queue.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beacon-chain/sync/pending_attestations_queue.go b/beacon-chain/sync/pending_attestations_queue.go index c250015c98f..b8a547725f7 100644 --- a/beacon-chain/sync/pending_attestations_queue.go +++ b/beacon-chain/sync/pending_attestations_queue.go @@ -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 {