fix continue

This commit is contained in:
Bryan Stitt 2022-07-19 04:31:30 +00:00
parent 79f033e829
commit 85b8a3a4e8

View File

@ -448,18 +448,19 @@ impl Web3Connection {
.request("eth_getBlockByNumber", ("latest", false)) .request("eth_getBlockByNumber", ("latest", false))
.await; .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(); let new_hash = block.hash.unwrap();
if new_hash == last_hash { if new_hash != last_hash {
continue; last_hash = new_hash;
self.send_block_result(Ok(block), &block_sender).await?;
} }
} else {
last_hash = new_hash; // 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) => { Err(err) => {
warn!(?err, "Rate limited on latest block from {}", self); warn!(?err, "Rate limited on latest block from {}", self);