fix panic

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

View File

@ -995,10 +995,8 @@ impl Web3Rpc {
.await?;
}
Ok(Some(block)) => {
if let Some(new_hash) = block.hash {
// don't send repeat blocks
let new_hash =
block.hash.expect("blocks here should always have hashes");
if new_hash != last_hash {
// new hash!
last_hash = new_hash;
@ -1010,6 +1008,17 @@ impl Web3Rpc {
)
.await?;
}
} else {
// TODO: why is this happening?
warn!("empty head block on {}", self);
self.send_head_block_result(
Ok(None),
&block_sender,
block_map.clone(),
)
.await?;
}
}
Err(err) => {
// we did not get a block back. something is up with the server. take it out of rotation