From d706a53c04f9c6882f81af160d4d89b921c4cd9d Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 24 Oct 2023 18:16:59 -0700 Subject: [PATCH] skip backups in another place --- web3_proxy/src/rpcs/consensus.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web3_proxy/src/rpcs/consensus.rs b/web3_proxy/src/rpcs/consensus.rs index eadac935..3d238dbf 100644 --- a/web3_proxy/src/rpcs/consensus.rs +++ b/web3_proxy/src/rpcs/consensus.rs @@ -211,7 +211,7 @@ impl RankedRpcs { let num_active = self.num_active_rpcs(); // these are bigger than we need, but how much does that matter? - let mut inner_for_request = Vec::>::with_capacity(num_active); + let mut inner_for_request = Vec::with_capacity(num_active); let mut outer_for_request = Vec::with_capacity(num_active); // TODO: what if min is set to some future block? @@ -221,7 +221,10 @@ impl RankedRpcs { // TODO: max lag was already handled for rpc in self.inner.iter().cloned() { - // if web3_request.head_block.is_some() { + if rpc.backup && !self.backups_needed { + continue; + } + if let Some(block_needed) = min_block_needed { if !rpc.has_block_data(block_needed) { outer_for_request.push(rpc); @@ -234,7 +237,6 @@ impl RankedRpcs { continue; } } - // } inner_for_request.push(rpc); }