Skip to content

Commit

Permalink
validator: invert vote account sanity check arg
Browse files Browse the repository at this point in the history
  • Loading branch information
t-nelson authored and mergify[bot] committed Feb 16, 2022
1 parent 7d0a0a2 commit 2c1cec4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
8 changes: 5 additions & 3 deletions validator/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
17 changes: 16 additions & 1 deletion validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2c1cec4

Please sign in to comment.