mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 21:17:16 +00:00
26 lines
406 B
Go
26 lines
406 B
Go
|
package health
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/ledgerwatch/log/v3"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
errNotSynced = errors.New("not synced")
|
||
|
)
|
||
|
|
||
|
func checkSynced(ethAPI EthAPI, r *http.Request) error {
|
||
|
i, err := ethAPI.Syncing(r.Context())
|
||
|
if err != nil {
|
||
|
log.Root().Warn("unable to process synced request", "err", err.Error())
|
||
|
return err
|
||
|
}
|
||
|
if i == nil || i == false {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
return errNotSynced
|
||
|
}
|