mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-26 17:59:29 +00:00
17 lines
373 B
Go
17 lines
373 B
Go
package health
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/ethclient"
|
|
)
|
|
|
|
func checkBlockNumber(ec *ethclient.Client, blockNumber *big.Int) error {
|
|
_, err := ec.BlockByNumber(context.TODO(), blockNumber)
|
|
if err != nil {
|
|
return fmt.Errorf("no known block with number %v (%x hex)", blockNumber.Int64(), blockNumber.Int64())
|
|
}
|
|
return nil
|
|
}
|