validator: invert vote account sanity check arg

This commit is contained in:
Trent Nelson 2022-02-14 23:50:17 -07:00 committed by Trent Nelson
parent aeda27433f
commit de30699fa5
2 changed files with 21 additions and 4 deletions

View File

@ -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<String>,
pub incremental_snapshot_fetch: bool,
}
@ -603,7 +603,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(),
@ -943,7 +944,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(),

View File

@ -547,8 +547,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")
@ -1948,10 +1958,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,