if block fails, try other rpcs

This commit is contained in:
Bryan Stitt 2023-08-03 00:29:13 -07:00
parent 5747caec71
commit ca802751c1
2 changed files with 5 additions and 3 deletions

@ -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

@ -298,7 +298,7 @@ impl Web3Rpcs {
let mut block: Option<ArcBlock> = 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<ArcBlock>>(
"eth_getBlockByHash",
&get_block_params,
@ -306,7 +306,9 @@ impl Web3Rpcs {
max_tries,
max_wait,
)
.await?
.await
.ok()
.flatten()
} else {
None
};