Try to reconnect ethereum RPC in case of network failure
This commit is contained in:
parent
d26995a1e4
commit
34e5599362
@ -1097,6 +1097,7 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
|
||||
ci, err := w.chain.GetChainInfo()
|
||||
var backendError string
|
||||
if err != nil {
|
||||
glog.Error("GetChainInfo error ", err)
|
||||
backendError = errors.Annotatef(err, "GetChainInfo").Error()
|
||||
ci = &bchain.ChainInfo{}
|
||||
// set not in sync in case of backend error
|
||||
|
||||
@ -327,13 +327,13 @@ func (b *EthereumRPC) GetSubversion() string {
|
||||
|
||||
// GetChainInfo returns information about the connected backend
|
||||
func (b *EthereumRPC) GetChainInfo() (*bchain.ChainInfo, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), b.timeout)
|
||||
defer cancel()
|
||||
id, err := b.client.NetworkID(ctx)
|
||||
h, err := b.getBestHeader()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h, err := b.getBestHeader()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), b.timeout)
|
||||
defer cancel()
|
||||
id, err := b.client.NetworkID(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user