Setup bank hard_forks in load_bank_forks()

This commit is contained in:
Michael Vines 2022-03-15 19:54:08 -07:00
parent 455313584f
commit 390c5667f7
2 changed files with 18 additions and 15 deletions

View File

@ -148,6 +148,24 @@ pub fn load_bank_forks(
if process_options.full_leader_cache {
leader_schedule_cache.set_max_schedules(std::usize::MAX);
}
assert_eq!(bank_forks.banks().len(), 1);
if let Some(ref new_hard_forks) = process_options.new_hard_forks {
let root_bank = bank_forks.root_bank();
let hard_forks = root_bank.hard_forks();
for hard_fork_slot in new_hard_forks.iter() {
if *hard_fork_slot > root_bank.slot() {
hard_forks.write().unwrap().register(*hard_fork_slot);
} else {
warn!(
"Hard fork at {} ignored, --hard-fork option can be removed.",
hard_fork_slot
);
}
}
}
(bank_forks, leader_schedule_cache, starting_snapshot_hashes)
}

View File

@ -655,21 +655,6 @@ pub fn process_blockstore_from_root(
info!("processing ledger from slot {}...", start_slot);
let now = Instant::now();
if let Some(ref new_hard_forks) = opts.new_hard_forks {
let hard_forks = bank.hard_forks();
for hard_fork_slot in new_hard_forks.iter() {
if *hard_fork_slot > start_slot {
hard_forks.write().unwrap().register(*hard_fork_slot);
} else {
warn!(
"Hard fork at {} ignored, --hard-fork option can be removed.",
hard_fork_slot
);
}
}
}
// ensure start_slot is rooted for correct replay
if blockstore.is_primary_access() {
blockstore