From 85b8a3a4e84694455b938dcf14848918bfc44c2f Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 19 Jul 2022 04:31:30 +0000 Subject: [PATCH] fix continue --- web3-proxy/src/connection.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/web3-proxy/src/connection.rs b/web3-proxy/src/connection.rs index f66ce974..d5a07c26 100644 --- a/web3-proxy/src/connection.rs +++ b/web3-proxy/src/connection.rs @@ -448,18 +448,19 @@ impl Web3Connection { .request("eth_getBlockByNumber", ("latest", false)) .await; - // don't send repeat blocks - if let Ok(block) = &block { + if let Ok(block) = block { + // don't send repeat blocks let new_hash = block.hash.unwrap(); - if new_hash == last_hash { - continue; + if new_hash != last_hash { + last_hash = new_hash; + + self.send_block_result(Ok(block), &block_sender).await?; } - - last_hash = new_hash; + } else { + // we got an empty block back. thats not good + self.send_block_result(block, &block_sender).await?; } - - self.send_block_result(block, &block_sender).await?; } Err(err) => { warn!(?err, "Rate limited on latest block from {}", self);