Make a simple json-rpc call to ensure we are connected to a real ETH1 node (#6191)

* Make a simple json-rpc call to ensure we are connected to a real node
* Merge refs/heads/master into check-connection
This commit is contained in:
Preston Van Loon
2020-06-09 14:26:15 -07:00
committed by GitHub
parent 50af507407
commit 47dacb88f7

View File

@@ -338,6 +338,12 @@ func (s *Service) dialETH1Nodes() (*ethclient.Client, *gethRPC.Client, error) {
return nil, nil, err
}
httpClient := ethclient.NewClient(httpRPCClient)
// Make a simple call to ensure we are actually connected to a working node.
if _, err := httpClient.ChainID(s.ctx); err != nil {
return nil, nil, err
}
return httpClient, httpRPCClient, nil
}