From 0d36ee0fbee3c5e58caa900e5380609806a7929f Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Sun, 5 Apr 2026 01:01:27 -0700 Subject: [PATCH] testing --- beacon_node/store/src/hot_cold_store.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index e0fd0c48f8..b6564bed1b 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -1899,14 +1899,18 @@ impl, Cold: ItemStore> HotColdDB return Ok(StatePayloadStatus::Pending); } + // If the latest block was at this slot, the state is definitively `Pending` (post-block, + // pre-payload). Check this before loading the previous summary to avoid errors when the + // previous state doesn't exist (e.g. checkpoint sync where only one state is stored). + if summary.slot == summary.latest_block_slot { + return Ok(StatePayloadStatus::Pending); + } + // Load the hot state summary for the previous state. // // If it has the same slot as this summary then we know this summary is for a `Full` state // (payload state), because they are always diffed against their same-slot `Pending` state. // - // If the previous summary has a different slot AND the latest block is from `summary.slot`, - // then this state *must* be `Pending` (it is the summary for latest block itself). - // // Otherwise, we are at a skipped slot and must traverse the graph of state summaries // backwards until we reach a summary for the latest block. This recursion could be quite // far in the case of a long skip. We could optimise this in future using the @@ -1918,8 +1922,6 @@ impl, Cold: ItemStore> HotColdDB if previous_state_summary.slot == summary.slot { Ok(StatePayloadStatus::Full) - } else if summary.slot == summary.latest_block_slot { - Ok(StatePayloadStatus::Pending) } else { self.get_hot_state_summary_payload_status(&previous_state_summary) }