Skip to content

Commit

Permalink
Try to reconnect ethereum RPC in case of network failure
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed Jun 10, 2019
1 parent c916d46 commit c4487ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bchain/coins/eth/ethrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4487ac

Please sign in to comment.