Skip to content

Commit

Permalink
Fix blockstore_processor::load_frozen_forks() halt_at_slot behavior II (
Browse files Browse the repository at this point in the history
#28367)

PR #28317 previously attempted to fix a case where blockstore processing
would create children banks for slots past the halt_at_slot.

However, the previous fix didn't handle the case where a slot could be
strictly less than the halt_at_slot, but have children that were greater
than the halt_at_slot. For example, this could happen if a child of slot
S is S+n where n > 1.

Thus, this change covers our processing logic to cover this second case
as well.
  • Loading branch information
steviez authored Oct 12, 2022
1 parent 8036f6f commit b8acb1b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,13 +1360,21 @@ fn process_next_slots(
blockstore: &Blockstore,
leader_schedule_cache: &LeaderScheduleCache,
pending_slots: &mut Vec<(SlotMeta, Bank, Hash)>,
halt_at_slot: Option<Slot>,
) -> result::Result<(), BlockstoreProcessorError> {
if meta.next_slots.is_empty() {
return Ok(());
}

// This is a fork point if there are multiple children, create a new child bank for each fork
for next_slot in &meta.next_slots {
let skip_next_slot = halt_at_slot
.map(|halt_at_slot| *next_slot > halt_at_slot)
.unwrap_or(false);
if skip_next_slot {
continue;
}

let next_meta = blockstore
.meta(*next_slot)
.map_err(|err| {
Expand Down Expand Up @@ -1438,6 +1446,7 @@ fn load_frozen_forks(
blockstore,
leader_schedule_cache,
&mut pending_slots,
opts.halt_at_slot,
)?;

let on_halt_store_hash_raw_data_for_debug = opts.on_halt_store_hash_raw_data_for_debug;
Expand Down Expand Up @@ -1604,6 +1613,7 @@ fn load_frozen_forks(
blockstore,
leader_schedule_cache,
&mut pending_slots,
opts.halt_at_slot,
)?;
}
} else if on_halt_store_hash_raw_data_for_debug {
Expand Down

0 comments on commit b8acb1b

Please sign in to comment.