From ca802751c1250ebd6ec67a14df3448574d8a4375 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Thu, 3 Aug 2023 00:29:13 -0700 Subject: [PATCH] if block fails, try other rpcs --- README.md | 2 +- web3_proxy/src/rpcs/blockchain.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3eb64195..44f64011 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ RUST_LOG=web3_proxy=trace,info cargo nextest run Run more tests: ``` -RUST_LOG=web3_proxy=trace,info cargo nextest run --features tests-needing-docker,tests_utils +RUST_LOG=web3_proxy=trace,info cargo nextest run --features tests-needing-docker ``` ## Mysql diff --git a/web3_proxy/src/rpcs/blockchain.rs b/web3_proxy/src/rpcs/blockchain.rs index 377af889..25593a59 100644 --- a/web3_proxy/src/rpcs/blockchain.rs +++ b/web3_proxy/src/rpcs/blockchain.rs @@ -298,7 +298,7 @@ impl Web3Rpcs { let mut block: Option = if let Some(rpc) = rpc { // ask a specific rpc - // this doesn't have retries, so we do retries with `self.internal_request` below (note the "self" vs "rpc") + // if this errors, other rpcs will be tried rpc.internal_request::<_, Option>( "eth_getBlockByHash", &get_block_params, @@ -306,7 +306,9 @@ impl Web3Rpcs { max_tries, max_wait, ) - .await? + .await + .ok() + .flatten() } else { None };