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