From 2e3b40a88535a3d4376dd4f29090f357ca800e70 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 24 Oct 2023 23:33:24 -0700 Subject: [PATCH] move health check during voting --- web3_proxy/src/rpcs/consensus.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web3_proxy/src/rpcs/consensus.rs b/web3_proxy/src/rpcs/consensus.rs index cde893b1..d6be5815 100644 --- a/web3_proxy/src/rpcs/consensus.rs +++ b/web3_proxy/src/rpcs/consensus.rs @@ -759,11 +759,6 @@ impl ConsensusFinder { .rpc_heads .iter() .filter(|(rpc, x)| { - if !rpc.healthy.load(atomic::Ordering::Relaxed) { - // TODO: we might go backwards if this happens. make sure we hold on to highest block from a previous run - return false; - } - if let Some(max_block_age) = self.max_head_block_age { if x.age() > max_block_age { return false; @@ -809,6 +804,11 @@ impl ConsensusFinder { HashMap::with_capacity(num_known); for (rpc, rpc_head) in self.rpc_heads.iter() { + if !rpc.healthy.load(atomic::Ordering::Relaxed) { + // TODO: should unhealthy servers get a vote? they were included in minmax_block. i think that is enough + continue; + } + let mut block_to_check = rpc_head.clone(); while block_to_check.number() >= lowest_block_number {