health: Remove unrequired uint64 conversation

This commit is contained in:
crypto-services 2024-02-22 15:12:27 +08:00
parent be217124cb
commit ff742cb8d5
2 changed files with 4 additions and 4 deletions

View File

@ -11,12 +11,12 @@ var (
)
// checkMinPeers returns 'errNotEnoughPeers' if the current peer count its lower than 'minPeerCount'
func checkMinPeers(ec ethClient, minPeerCount uint) error {
func checkMinPeers(ec ethClient, minPeerCount uint64) error {
peerCount, err := ec.PeerCount(context.TODO())
if err != nil {
return err
}
if uint64(peerCount) < uint64(minPeerCount) {
if peerCount < minPeerCount {
return fmt.Errorf("%w: %d (minimum %d)", errNotEnoughPeers, peerCount, minPeerCount)
}
return nil

View File

@ -55,7 +55,7 @@ func processFromHeaders(ec ethClient, headers []string, w http.ResponseWriter, r
errCheckPeer = err
break
}
errCheckPeer = checkMinPeers(ec, uint(peers))
errCheckPeer = checkMinPeers(ec, uint64(peers))
case strings.HasPrefix(lHeader, checkBlock):
block, err := strconv.Atoi(strings.TrimPrefix(lHeader, checkBlock))
if err != nil {
@ -101,7 +101,7 @@ func processFromBody(ec ethClient, w http.ResponseWriter, r *http.Request) {
}
if body.MinPeerCount != nil {
errCheckPeer = checkMinPeers(ec, *body.MinPeerCount)
errCheckPeer = checkMinPeers(ec, uint64(*body.MinPeerCount))
}
if body.CheckBlock != nil {