From 8926b5811e897029d1398c844283c26d5b1ccd2a Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sat, 9 Jul 2022 03:34:39 +0000 Subject: [PATCH] pass archive_needed deeper --- web3-proxy/src/connections.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web3-proxy/src/connections.rs b/web3-proxy/src/connections.rs index ae44bd51..c810d25b 100644 --- a/web3-proxy/src/connections.rs +++ b/web3-proxy/src/connections.rs @@ -603,6 +603,7 @@ impl Web3Connections { pub async fn next_upstream_server( &self, skip: &[Arc], + archive_needed: bool, ) -> Result> { let mut earliest_retry_after = None; @@ -667,7 +668,10 @@ impl Web3Connections { /// get all rpc servers that are not rate limited /// returns servers even if they aren't in sync. This is useful for broadcasting signed transactions - pub async fn get_upstream_servers(&self) -> Result, Option> { + pub async fn get_upstream_servers( + &self, + archive_needed: bool, + ) -> Result, Option> { let mut earliest_retry_after = None; // TODO: with capacity? let mut selected_rpcs = vec![]; @@ -704,7 +708,7 @@ impl Web3Connections { if skip_rpcs.len() == self.inner.len() { break; } - match self.next_upstream_server(&skip_rpcs).await { + match self.next_upstream_server(&skip_rpcs, archive_needed).await { Ok(active_request_handle) => { // save the rpc in case we get an error and want to retry on another server skip_rpcs.push(active_request_handle.clone_connection()); @@ -784,7 +788,7 @@ impl Web3Connections { archive_needed: bool, ) -> anyhow::Result { loop { - match self.get_upstream_servers().await { + match self.get_upstream_servers(archive_needed).await { Ok(active_request_handles) => { // TODO: benchmark this compared to waiting on unbounded futures // TODO: do something with this handle?