fix panic

This commit is contained in:
Bryan Stitt 2023-05-15 13:19:57 -07:00
parent cfe4b2bf56
commit 1ab98f1edc

View File

@ -995,16 +995,25 @@ impl Web3Rpc {
.await?;
}
Ok(Some(block)) => {
// don't send repeat blocks
let new_hash =
block.hash.expect("blocks here should always have hashes");
if let Some(new_hash) = block.hash {
// don't send repeat blocks
if new_hash != last_hash {
// new hash!
last_hash = new_hash;
if new_hash != last_hash {
// new hash!
last_hash = new_hash;
self.send_head_block_result(
Ok(Some(block)),
&block_sender,
block_map.clone(),
)
.await?;
}
} else {
// TODO: why is this happening?
warn!("empty head block on {}", self);
self.send_head_block_result(
Ok(Some(block)),
Ok(None),
&block_sender,
block_map.clone(),
)