Fix blockstore_processor::load_frozen_forks() halt_at_slot behavior II (#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.
This commit is contained in:
steviez 2022-10-12 17:24:27 -05:00 committed by GitHub
parent 8036f6f304
commit b8acb1b350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -1360,6 +1360,7 @@ 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(());
@ -1367,6 +1368,13 @@ fn process_next_slots(
// 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| {
@ -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;
@ -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 {