Skip and warn for hard-forks which are less than the start slot (#10918)

* Skip and warn for hard-forks which are less than the start slot

Option is used during a restart, but then after the restart is
complete, then the option is not needed if the starting slot
is past the hard-fork since the hard-fork should already be
in the snapshot it started from.

* Update ledger/src/blockstore_processor.rs

Co-authored-by: Michael Vines <mvines@gmail.com>

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
sakridge 2020-07-05 13:51:43 -07:00 committed by GitHub
parent 28e15a63e5
commit 658de5b347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -323,16 +323,14 @@ pub fn process_blockstore_from_root(
let hard_forks = bank.hard_forks(); let hard_forks = bank.hard_forks();
for hard_fork_slot in new_hard_forks.iter() { for hard_fork_slot in new_hard_forks.iter() {
// Ensure the user isn't trying to add new hard forks for a slot that's earlier than the current if *hard_fork_slot > start_slot {
// root slot. Doing so won't cause any effect so emit an error hard_forks.write().unwrap().register(*hard_fork_slot);
if *hard_fork_slot < start_slot { } else {
error!( warn!(
"Unable to add new hard fork at {}, it must be greater than slot {}", "Hard fork at {} ignored, --hard-fork option can be removed.",
hard_fork_slot, start_slot hard_fork_slot
); );
return Err(BlockstoreProcessorError::InvalidHardFork(*hard_fork_slot));
} }
hard_forks.write().unwrap().register(*hard_fork_slot);
} }
} }