From c05e39a6685633fadf81f3380ad830c038757b61 Mon Sep 17 00:00:00 2001 From: kasey <489222+kasey@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:06:16 -0500 Subject: [PATCH] fix handling of goodbye messages for limited peers (#13785) Co-authored-by: Kasey Kirkham --- beacon-chain/sync/rpc_goodbye.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beacon-chain/sync/rpc_goodbye.go b/beacon-chain/sync/rpc_goodbye.go index 0a54c4bac..a32e8c884 100644 --- a/beacon-chain/sync/rpc_goodbye.go +++ b/beacon-chain/sync/rpc_goodbye.go @@ -42,9 +42,10 @@ func (s *Service) goodbyeRPCHandler(_ context.Context, msg interface{}, stream l return fmt.Errorf("wrong message type for goodbye, got %T, wanted *uint64", msg) } if err := s.rateLimiter.validateRequest(stream, 1); err != nil { - return err + log.WithError(err).Warn("Goodbye message from rate-limited peer.") + } else { + s.rateLimiter.add(stream, 1) } - s.rateLimiter.add(stream, 1) log := log.WithField("Reason", goodbyeMessage(*m)) log.WithField("peer", stream.Conn().RemotePeer()).Trace("Peer has sent a goodbye message") s.cfg.p2p.Peers().SetNextValidTime(stream.Conn().RemotePeer(), goodByeBackoff(*m))