Simplify do_process_blockstore_from_root slightly
This commit is contained in:
parent
b28acd2d4d
commit
93c8e04d51
|
@ -695,16 +695,14 @@ fn do_process_blockstore_from_root(
|
|||
|
||||
let mut timing = ExecuteTimings::default();
|
||||
// Iterate and replay slots from blockstore starting from `start_slot`
|
||||
let (initial_forks, leader_schedule_cache) = {
|
||||
if let Some(meta) = blockstore
|
||||
.meta(start_slot)
|
||||
.unwrap_or_else(|_| panic!("Failed to get meta for slot {}", start_slot))
|
||||
{
|
||||
let epoch_schedule = bank.epoch_schedule();
|
||||
let mut leader_schedule_cache = LeaderScheduleCache::new(*epoch_schedule, &bank);
|
||||
let mut leader_schedule_cache = LeaderScheduleCache::new_from_bank(&bank);
|
||||
if opts.full_leader_cache {
|
||||
leader_schedule_cache.set_max_schedules(std::usize::MAX);
|
||||
}
|
||||
let initial_forks = if let Some(meta) = blockstore
|
||||
.meta(start_slot)
|
||||
.unwrap_or_else(|_| panic!("Failed to get meta for slot {}", start_slot))
|
||||
{
|
||||
let mut initial_forks = load_frozen_forks(
|
||||
&bank,
|
||||
&meta,
|
||||
|
@ -721,15 +719,12 @@ fn do_process_blockstore_from_root(
|
|||
&mut last_full_snapshot_slot,
|
||||
)?;
|
||||
initial_forks.sort_by_key(|bank| bank.slot());
|
||||
|
||||
(initial_forks, leader_schedule_cache)
|
||||
initial_forks
|
||||
} else {
|
||||
// If there's no meta for the input `start_slot`, then we started from a snapshot
|
||||
// and there's no point in processing the rest of blockstore and implies blockstore
|
||||
// should be empty past this point.
|
||||
let leader_schedule_cache = LeaderScheduleCache::new_from_bank(&bank);
|
||||
(vec![bank], leader_schedule_cache)
|
||||
}
|
||||
vec![bank]
|
||||
};
|
||||
if initial_forks.is_empty() {
|
||||
return Err(BlockstoreProcessorError::NoValidForksFound);
|
||||
|
|
Loading…
Reference in New Issue