diff --git a/ledger/src/bank_forks_utils.rs b/ledger/src/bank_forks_utils.rs index 4459178ef..1ee8b1106 100644 --- a/ledger/src/bank_forks_utils.rs +++ b/ledger/src/bank_forks_utils.rs @@ -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) } diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 2426ef0e4..dde1ce562 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -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