Fix lookups of the block at oldest_block_slot (#7693)

Closes:

- https://github.com/sigp/lighthouse/issues/7690


  Another checkpoint sync related fix! See issue for a description of the bug.

We fix it by just loading the block root of the `oldest_block_slot`, rather than trying to load the slot prior, which will always fail.
This commit is contained in:
Michael Sproul
2025-07-03 09:40:04 +10:00
committed by GitHub
parent b35854b71f
commit c7bb3b00e4
2 changed files with 74 additions and 27 deletions

View File

@@ -991,6 +991,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
return Ok(root_opt);
}
// Do not try to access the previous slot if it's older than the oldest block root
// stored in the database. Instead, load just the block root at `oldest_block_slot`,
// under the assumption that the `oldest_block_slot` *is not* a skipped slot (should be
// true because it is set by the oldest *block*).
if request_slot == self.store.get_anchor_info().oldest_block_slot {
return self.block_root_at_slot_skips_prev(request_slot);
}
if let Some(((prev_root, _), (curr_root, curr_slot))) = process_results(
self.forwards_iter_block_roots_until(prev_slot, request_slot)?,
|iter| iter.tuple_windows().next(),