Skip to content

Commit

Permalink
query for block by state.latest_block_header.slot
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed Jun 13, 2023
1 parent 1ddd335 commit 36309d3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions beacon_node/client/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,11 @@ where

debug!(context.log(), "Downloaded finalized state"; "slot" => ?state.slot());

let block_root = state.get_block_root(state.slot()).map_err(|e| {
format!("Unable to get block root for slot {}: {e:?}", state.slot())
})?;
let finalized_block_slot = state.latest_block_header().slot;

debug!(context.log(), "Downloading finalized block"; "block_root" => ?block_root);
debug!(context.log(), "Downloading finalized block"; "block_slot" => ?finalized_block_slot);
let block = remote
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Root(*block_root), &spec)
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Slot(finalized_block_slot), &spec)
.await
.map_err(|e| match e {
ApiError::InvalidSsz(e) => format!(
Expand Down

0 comments on commit 36309d3

Please sign in to comment.