Skip to content

Commit

Permalink
Filter out zero-hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Mar 3, 2022
1 parent 6d269dd commit c03670e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3653,7 +3653,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}

// If this is a post-merge block, update the execution layer.
if let Some(new_head_execution_block_hash) = new_head_execution_block_hash_opt {
if let Some(new_head_execution_block_hash) =
new_head_execution_block_hash_opt.filter(|h| *h != ExecutionBlockHash::zero())
{
if is_merge_transition_complete {
let finalized_execution_block_hash = finalized_block
.execution_status
Expand Down Expand Up @@ -3704,6 +3706,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
head_block_root: Hash256,
head_execution_block_hash: ExecutionBlockHash,
) -> Result<(), Error> {
if head_execution_block_hash == ExecutionBlockHash::zero() {
debug!(
self.log,
"Not sending forkchoice updated";
"msg" => "head block hash is zero"
);
return Ok(());
}

let forkchoice_updated_response = self
.execution_layer
.as_ref()
Expand Down
5 changes: 4 additions & 1 deletion beacon_node/client/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,10 @@ where

// Issue the head to the execution engine on startup. This ensures it can start
// syncing.
if let Some(block_hash) = head.execution_payload_block_hash {
if let Some(block_hash) = head
.execution_payload_block_hash
.filter(|h| *h != ExecutionBlockHash::zero())
{
let finalized_root = head.finalized_checkpoint.root;
let finalized_block = beacon_chain
.store
Expand Down

0 comments on commit c03670e

Please sign in to comment.