Skip to content

Commit de30699

Browse files
committed
validator: invert vote account sanity check arg
1 parent aeda274 commit de30699

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

validator/src/bootstrap.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct RpcBootstrapConfig {
4747
pub no_snapshot_fetch: bool,
4848
pub only_known_rpc: bool,
4949
pub max_genesis_archive_unpacked_size: u64,
50-
pub no_check_vote_account: bool,
50+
pub check_vote_account: Option<String>,
5151
pub incremental_snapshot_fetch: bool,
5252
}
5353

@@ -603,7 +603,8 @@ mod without_incremental_snapshots {
603603
}
604604
})
605605
.map(|_| {
606-
if !validator_config.voting_disabled && !bootstrap_config.no_check_vote_account {
606+
if let Some(url) = bootstrap_config.check_vote_account.as_ref() {
607+
let rpc_client = RpcClient::new(url);
607608
check_vote_account(
608609
&rpc_client,
609610
&identity_keypair.pubkey(),
@@ -943,7 +944,8 @@ mod with_incremental_snapshots {
943944
)
944945
})
945946
.map(|_| {
946-
if !validator_config.voting_disabled && !bootstrap_config.no_check_vote_account {
947+
if let Some(url) = bootstrap_config.check_vote_account.as_ref() {
948+
let rpc_client = RpcClient::new(url);
947949
check_vote_account(
948950
&rpc_client,
949951
&identity_keypair.pubkey(),

validator/src/main.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,18 @@ pub fn main() {
547547
.takes_value(false)
548548
.conflicts_with("no_voting")
549549
.requires("entrypoint")
550+
.hidden(true)
550551
.help("Skip the RPC vote account sanity check")
551552
)
553+
.arg(
554+
Arg::with_name("check_vote_account")
555+
.long("check-vote-account")
556+
.takes_value(true)
557+
.value_name("RPC_URL")
558+
.requires("entrypoint")
559+
.conflicts_with_all(&["no_check_vote_account", "no_voting"])
560+
.help("Sanity check vote account state at startup. The JSON RPC endpoint at RPC_URL must expose `--full-rpc-api`")
561+
)
552562
.arg(
553563
Arg::with_name("restricted_repair_only_mode")
554564
.long("restricted-repair-only-mode")
@@ -1948,10 +1958,15 @@ pub fn main() {
19481958

19491959
let init_complete_file = matches.value_of("init_complete_file");
19501960

1961+
if matches.is_present("no_check_vote_account") {
1962+
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");
1963+
}
19511964
let rpc_bootstrap_config = bootstrap::RpcBootstrapConfig {
19521965
no_genesis_fetch: matches.is_present("no_genesis_fetch"),
19531966
no_snapshot_fetch: matches.is_present("no_snapshot_fetch"),
1954-
no_check_vote_account: matches.is_present("no_check_vote_account"),
1967+
check_vote_account: matches
1968+
.value_of("check_vote_account")
1969+
.map(|url| url.to_string()),
19551970
only_known_rpc: matches.is_present("only_known_rpc"),
19561971
max_genesis_archive_unpacked_size: value_t_or_exit!(
19571972
matches,

0 commit comments

Comments
 (0)