From 36309d332f58c965dc905c8d3fe03e211257aad6 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Tue, 13 Jun 2023 12:26:27 -0400 Subject: [PATCH] query for block by `state.latest_block_header.slot` --- beacon_node/client/src/builder.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/beacon_node/client/src/builder.rs b/beacon_node/client/src/builder.rs index feec23f739f..580504c9502 100644 --- a/beacon_node/client/src/builder.rs +++ b/beacon_node/client/src/builder.rs @@ -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::(BlockId::Root(*block_root), &spec) + .get_beacon_blocks_ssz::(BlockId::Slot(finalized_block_slot), &spec) .await .map_err(|e| match e { ApiError::InvalidSsz(e) => format!(