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