From c4487ac94babb22cdb7af71fc56d084f5eec8c31 Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Mon, 10 Jun 2019 16:48:31 +0200 Subject: [PATCH] Try to reconnect ethereum RPC in case of network failure --- bchain/coins/eth/ethrpc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bchain/coins/eth/ethrpc.go b/bchain/coins/eth/ethrpc.go index 4142a25d..89813487 100644 --- a/bchain/coins/eth/ethrpc.go +++ b/bchain/coins/eth/ethrpc.go @@ -370,7 +370,8 @@ func (b *EthereumRPC) getBestHeader() (*ethtypes.Header, error) { } } // if the best header was not updated for 15 minutes, there could be a subscription problem, reconnect RPC - if b.bestHeaderTime.Add(15 * time.Minute).Before(time.Now()) { + // do it only in case of normal operation, not initial synchronization + if b.bestHeaderTime.Add(15*time.Minute).Before(time.Now()) && !b.bestHeaderTime.IsZero() && b.mempoolInitialized { err := b.reconnectRPC() if err != nil { return nil, err