From 658de5b347b8ce9c04dbed7a7c5edb91da9a487e Mon Sep 17 00:00:00 2001 From: sakridge Date: Sun, 5 Jul 2020 13:51:43 -0700 Subject: [PATCH] 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 Co-authored-by: Michael Vines --- ledger/src/blockstore_processor.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index b29b3182b9..8ea7634776 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -323,16 +323,14 @@ pub fn process_blockstore_from_root( let hard_forks = bank.hard_forks(); 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 - // root slot. Doing so won't cause any effect so emit an error - if *hard_fork_slot < start_slot { - error!( - "Unable to add new hard fork at {}, it must be greater than slot {}", - hard_fork_slot, start_slot + 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 ); - return Err(BlockstoreProcessorError::InvalidHardFork(*hard_fork_slot)); } - hard_forks.write().unwrap().register(*hard_fork_slot); } }