From b8acb1b350ef5cdccea36bdfef2fdedb296a1038 Mon Sep 17 00:00:00 2001 From: steviez Date: Wed, 12 Oct 2022 17:24:27 -0500 Subject: [PATCH] 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. --- ledger/src/blockstore_processor.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index fc3ae1d5231dd4..142dc38b814a4a 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -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, ) -> 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 {