Skip to content

Commit

Permalink
avoid TTD query
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed Dec 9, 2021
1 parent b88cfb1 commit 5982466
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions beacon_node/beacon_chain/src/execution_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,28 +338,7 @@ pub async fn prepare_execution_payload_header<T: BeaconChainTypes>(
.as_ref()
.ok_or(BlockProductionError::ExecutionLayerMissing)?;

let parent_hash = if !is_merge_transition_complete(state) {
let is_terminal_block_hash_set = spec.terminal_block_hash != Hash256::zero();
let is_activation_epoch_reached =
state.current_epoch() >= spec.terminal_block_hash_activation_epoch;

if is_terminal_block_hash_set && !is_activation_epoch_reached {
return Ok(None);
}

let terminal_pow_block_hash = execution_layer
.get_terminal_pow_block_hash(spec)
.await
.map_err(BlockProductionError::TerminalPoWBlockLookupFailed)?;

if let Some(terminal_pow_block_hash) = terminal_pow_block_hash {
terminal_pow_block_hash
} else {
return Ok(None);
}
} else {
state.latest_execution_payload_header()?.block_hash
};
let parent_hash = state.latest_execution_payload_header()?.block_hash;

let timestamp = compute_timestamp_at_slot(state, spec).map_err(BeaconStateError::from)?;
let random = *state.get_randao_mix(state.current_epoch())?;
Expand Down

0 comments on commit 5982466

Please sign in to comment.