Skip to content

Commit 36309d3

Browse files
committed
query for block by state.latest_block_header.slot
1 parent 1ddd335 commit 36309d3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

beacon_node/client/src/builder.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,11 @@ where
350350

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

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

357-
debug!(context.log(), "Downloading finalized block"; "block_root" => ?block_root);
355+
debug!(context.log(), "Downloading finalized block"; "block_slot" => ?finalized_block_slot);
358356
let block = remote
359-
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Root(*block_root), &spec)
357+
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Slot(finalized_block_slot), &spec)
360358
.await
361359
.map_err(|e| match e {
362360
ApiError::InvalidSsz(e) => format!(

0 commit comments

Comments
 (0)