From 21761435f2dec887820b24ab19f76f2a63ff31dc Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 6 May 2022 21:04:02 +0000 Subject: [PATCH] skip nodes on block 0 --- web3-proxy/src/connections.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web3-proxy/src/connections.rs b/web3-proxy/src/connections.rs index 66f9ae49..6128b2fc 100644 --- a/web3-proxy/src/connections.rs +++ b/web3-proxy/src/connections.rs @@ -186,10 +186,15 @@ impl Web3Connections { pub fn update_synced_rpcs(&self, rpc: &Arc) -> anyhow::Result<()> { let mut synced_connections = self.synced_connections.write(); - let current_best_block_number = synced_connections.head_block_number; - let new_block = rpc.head_block_number(); + if new_block == 0 { + warn!("{:?} is still syncing", rpc); + return Ok(()); + } + + let current_best_block_number = synced_connections.head_block_number; + let overall_best_head_block = self.head_block_number(); // TODO: double check this logic @@ -210,8 +215,8 @@ impl Web3Connections { atomic::Ordering::AcqRel, atomic::Ordering::Acquire, ) { - Ok(current_best_block_number) => { - info!("new head block from {}: {}", rpc, current_best_block_number); + Ok(_) => { + info!("new head block from {}: {}", rpc, new_block); } Err(current_best_block_number) => { // actually, there was a race and this ended up not being the latest block. return now without adding this rpc to the synced list