health: Remove unrequired uint64 conversation
This commit is contained in:
parent
be217124cb
commit
ff742cb8d5
|
@ -11,12 +11,12 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// checkMinPeers returns 'errNotEnoughPeers' if the current peer count its lower than 'minPeerCount'
|
// 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())
|
peerCount, err := ec.PeerCount(context.TODO())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if uint64(peerCount) < uint64(minPeerCount) {
|
if peerCount < minPeerCount {
|
||||||
return fmt.Errorf("%w: %d (minimum %d)", errNotEnoughPeers, peerCount, minPeerCount)
|
return fmt.Errorf("%w: %d (minimum %d)", errNotEnoughPeers, peerCount, minPeerCount)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -55,7 +55,7 @@ func processFromHeaders(ec ethClient, headers []string, w http.ResponseWriter, r
|
||||||
errCheckPeer = err
|
errCheckPeer = err
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
errCheckPeer = checkMinPeers(ec, uint(peers))
|
errCheckPeer = checkMinPeers(ec, uint64(peers))
|
||||||
case strings.HasPrefix(lHeader, checkBlock):
|
case strings.HasPrefix(lHeader, checkBlock):
|
||||||
block, err := strconv.Atoi(strings.TrimPrefix(lHeader, checkBlock))
|
block, err := strconv.Atoi(strings.TrimPrefix(lHeader, checkBlock))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -101,7 +101,7 @@ func processFromBody(ec ethClient, w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.MinPeerCount != nil {
|
if body.MinPeerCount != nil {
|
||||||
errCheckPeer = checkMinPeers(ec, *body.MinPeerCount)
|
errCheckPeer = checkMinPeers(ec, uint64(*body.MinPeerCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.CheckBlock != nil {
|
if body.CheckBlock != nil {
|
||||||
|
|
Loading…
Reference in New Issue