From 962c93fd8df5a0e9094671c9ba614c4a1ce58b19 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Fri, 2 Aug 2024 13:22:07 -0600 Subject: [PATCH] Add --no-restart flag --- src/kubernetes.rs | 3 +++ src/main.rs | 7 +++++++ src/validator_config.rs | 1 + 3 files changed, 11 insertions(+) diff --git a/src/kubernetes.rs b/src/kubernetes.rs index 3dea15c..8aaa52d 100644 --- a/src/kubernetes.rs +++ b/src/kubernetes.rs @@ -329,6 +329,9 @@ impl<'a> Kubernetes<'a> { if self.validator_config.require_tower { flags.push("--require-tower".to_string()); } + if !self.validator_config.restart { + flags.push("--no-restart".to_string()); + } if let Some(limit_ledger_size) = self.validator_config.max_ledger_size { flags.push("--limit-ledger-size".to_string()); diff --git a/src/main.rs b/src/main.rs index e86b515..186844a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -254,6 +254,12 @@ fn parse_matches() -> clap::ArgMatches { .default_value("100") .help("The commission taken by nodes on staking rewards (0-100)") ) + .arg( + Arg::with_name("no_restart") + .long("no-restart") + .help("Validator config. If set, validators will not restart after \ + exiting for any reason."), + ) //RPC config .arg( Arg::with_name("number_of_rpc_nodes") @@ -535,6 +541,7 @@ async fn main() -> Result<(), Box> { require_tower: matches.is_present("require_tower"), enable_full_rpc: matches.is_present("enable_full_rpc"), known_validators: vec![], + restart: !matches.is_present("no_restart"), }; if num_rpc_nodes == 0 && !validator_config.enable_full_rpc { diff --git a/src/validator_config.rs b/src/validator_config.rs index f91b361..93fe515 100644 --- a/src/validator_config.rs +++ b/src/validator_config.rs @@ -12,4 +12,5 @@ pub struct ValidatorConfig { pub require_tower: bool, pub enable_full_rpc: bool, pub known_validators: Vec, + pub restart: bool, }