From b51715d33c6d5b9d2faaf61071daee88e0de5d25 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 20 Oct 2020 03:31:04 +0000 Subject: [PATCH] validator: Activate RPC before halting on slot (#13002) (cherry picked from commit 3b3f7341fa244748ea2e52ca6190a3140b23dc1e) Co-authored-by: Trent Nelson --- core/src/validator.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/validator.rs b/core/src/validator.rs index 7d032a074e..821a3cce87 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -368,19 +368,6 @@ impl Validator { leader_schedule_cache.slot_leader_at(bank.slot(), Some(&bank)) ); - if config.dev_halt_at_slot.is_some() { - // Simulate a confirmed root to avoid RPC errors with CommitmentConfig::max() and - // to ensure RPC endpoints like getConfirmedBlock, which require a confirmed root, work - block_commitment_cache - .write() - .unwrap() - .set_highest_confirmed_root(bank_forks.read().unwrap().root()); - - // Park with the RPC service running, ready for inspection! - warn!("Validator halted"); - std::thread::park(); - } - let poh_config = Arc::new(genesis_config.poh_config.clone()); let (mut poh_recorder, entry_receiver) = PohRecorder::new_with_clear_signal( bank.tick_height(), @@ -464,6 +451,19 @@ impl Validator { (None, None) }; + if config.dev_halt_at_slot.is_some() { + // Simulate a confirmed root to avoid RPC errors with CommitmentConfig::max() and + // to ensure RPC endpoints like getConfirmedBlock, which require a confirmed root, work + block_commitment_cache + .write() + .unwrap() + .set_highest_confirmed_root(bank_forks.read().unwrap().root()); + + // Park with the RPC service running, ready for inspection! + warn!("Validator halted"); + std::thread::park(); + } + let ip_echo_server = solana_net_utils::ip_echo_server(node.sockets.ip_echo.unwrap()); let gossip_service = GossipService::new(