diff --git a/validator/src/bootstrap.rs b/validator/src/bootstrap.rs index b5dc9d927b23bc..25c6fefbd7dabb 100644 --- a/validator/src/bootstrap.rs +++ b/validator/src/bootstrap.rs @@ -47,7 +47,7 @@ pub struct RpcBootstrapConfig { pub no_snapshot_fetch: bool, pub only_known_rpc: bool, pub max_genesis_archive_unpacked_size: u64, - pub no_check_vote_account: bool, + pub check_vote_account: Option, pub incremental_snapshot_fetch: bool, } @@ -602,7 +602,8 @@ mod without_incremental_snapshots { } }) .map(|_| { - if !validator_config.voting_disabled && !bootstrap_config.no_check_vote_account { + if let Some(url) = bootstrap_config.check_vote_account.as_ref() { + let rpc_client = RpcClient::new(url); check_vote_account( &rpc_client, &identity_keypair.pubkey(), @@ -942,7 +943,8 @@ mod with_incremental_snapshots { ) }) .map(|_| { - if !validator_config.voting_disabled && !bootstrap_config.no_check_vote_account { + if let Some(url) = bootstrap_config.check_vote_account.as_ref() { + let rpc_client = RpcClient::new(url); check_vote_account( &rpc_client, &identity_keypair.pubkey(), diff --git a/validator/src/main.rs b/validator/src/main.rs index b67199153466cd..9f50fc2e942671 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -627,8 +627,18 @@ pub fn main() { .takes_value(false) .conflicts_with("no_voting") .requires("entrypoint") + .hidden(true) .help("Skip the RPC vote account sanity check") ) + .arg( + Arg::with_name("check_vote_account") + .long("check-vote-account") + .takes_value(true) + .value_name("RPC_URL") + .requires("entrypoint") + .conflicts_with_all(&["no_check_vote_account", "no_voting"]) + .help("Sanity check vote account state at startup. The JSON RPC endpoint at RPC_URL must expose `--full-rpc-api`") + ) .arg( Arg::with_name("restricted_repair_only_mode") .long("restricted-repair-only-mode") @@ -1983,10 +1993,15 @@ pub fn main() { let init_complete_file = matches.value_of("init_complete_file"); + if matches.is_present("no_check_vote_account") { + info!("vote account sanity checks are no longer performed by default. --no-check-vote-account is deprecated and can be removed from the command line"); + } let rpc_bootstrap_config = bootstrap::RpcBootstrapConfig { no_genesis_fetch: matches.is_present("no_genesis_fetch"), no_snapshot_fetch: matches.is_present("no_snapshot_fetch"), - no_check_vote_account: matches.is_present("no_check_vote_account"), + check_vote_account: matches + .value_of("check_vote_account") + .map(|url| url.to_string()), only_known_rpc: matches.is_present("only_known_rpc"), max_genesis_archive_unpacked_size: value_t_or_exit!( matches,