diff --git a/network/network.go b/network/network.go index eab4ecca085e..defced950203 100644 --- a/network/network.go +++ b/network/network.go @@ -10,7 +10,6 @@ import ( "math" "net" "net/netip" - "strings" "sync" "sync/atomic" "time" @@ -409,25 +408,10 @@ func (n *network) HealthCheck(context.Context) (interface{}, error) { return details, nil } - var errorReasons []string - if !isConnected { - errorReasons = append(errorReasons, fmt.Sprintf("not connected to a minimum of %d peer(s) only %d", n.config.HealthConfig.MinConnectedPeers, connectedTo)) - } - if !msgReceived { - errorReasons = append(errorReasons, "no messages received from network") - } else if !wasMsgReceivedRecently { - errorReasons = append(errorReasons, fmt.Sprintf("no messages from network received in %s > %s", timeSinceLastMsgReceived, n.config.HealthConfig.MaxTimeSinceMsgReceived)) - } - if !msgSent { - errorReasons = append(errorReasons, "no messages sent to network") - } else if !wasMsgSentRecently { - errorReasons = append(errorReasons, fmt.Sprintf("no messages from network sent in %s > %s", timeSinceLastMsgSent, n.config.HealthConfig.MaxTimeSinceMsgSent)) - } - if !isMsgFailRate { - errorReasons = append(errorReasons, fmt.Sprintf("messages failure send rate %g > %g", sendFailRate, n.config.HealthConfig.MaxSendFailRate)) + return details, fmt.Errorf("messages failure send rate %g > %g", sendFailRate, n.config.HealthConfig.MaxSendFailRate) } - return details, fmt.Errorf("network layer is unhealthy reason: %s", strings.Join(errorReasons, ", ")) + return details, nil } // Connected is called after the peer finishes the handshake.