Skip to content

Commit

Permalink
fix handling of goodbye messages for limited peers (#13785)
Browse files Browse the repository at this point in the history
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
  • Loading branch information
kasey and kasey committed Mar 22, 2024
1 parent 63c2b35 commit c05e39a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions beacon-chain/sync/rpc_goodbye.go
Expand Up @@ -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))
Expand Down

0 comments on commit c05e39a

Please sign in to comment.