Skip to content

Commit

Permalink
ethereum: Add retry to chain id call
Browse files Browse the repository at this point in the history
  • Loading branch information
leoyvens committed Aug 11, 2021
1 parent bc9340e commit 2b41b3f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion chain/ethereum/src/ethereum_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,17 @@ impl EthereumAdapter {
}

pub async fn chain_id(&self) -> Result<u64, Error> {
Ok(u64::try_from(self.web3.eth().chain_id().compat().await?).unwrap())
let logger = self.logger.clone();
let web3 = self.web3.clone();
Ok(u64::try_from(
retry("chain_id RPC call", &logger)
.no_limit()
.timeout_secs(20)
.run(move || web3.eth().chain_id().from_err::<Error>())
.compat()
.await?,
)
.unwrap())
}
}

Expand Down

0 comments on commit 2b41b3f

Please sign in to comment.