diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index 874e0ec46f2c..cf40853ba8a7 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -4,6 +4,7 @@ import ( "context" "reflect" "runtime/debug" + "strings" libp2pcore "github.com/libp2p/go-libp2p/core" "github.com/libp2p/go-libp2p/core/network" @@ -206,7 +207,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { return } if err := s.cfg.p2p.Encoding().DecodeWithMaxLength(stream, msg); err != nil { - log.WithError(err).WithField("topic", topic).Debug("Could not decode stream message") + logStreamErrors(err, topic) tracing.AnnotateError(span, err) s.cfg.p2p.Peers().Scorers().BadResponsesScorer().Increment(stream.Conn().RemotePeer()) return @@ -226,7 +227,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { return } if err := s.cfg.p2p.Encoding().DecodeWithMaxLength(stream, msg); err != nil { - log.WithError(err).WithField("topic", topic).Debug("Could not decode stream message") + logStreamErrors(err, topic) tracing.AnnotateError(span, err) s.cfg.p2p.Peers().Scorers().BadResponsesScorer().Increment(stream.Conn().RemotePeer()) return @@ -241,3 +242,11 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { } }) } + +func logStreamErrors(err error, topic string) { + if strings.Contains(topic, p2p.RPCGoodByeTopicV1) { + log.WithError(err).WithField("topic", topic).Trace("Could not decode goodbye stream message") + return + } + log.WithError(err).WithField("topic", topic).Debug("Could not decode stream message") +}