diff --git a/clap-utils/src/commitment.rs b/clap-utils/src/commitment.rs index b7e0fa4cf7..566a14c066 100644 --- a/clap-utils/src/commitment.rs +++ b/clap-utils/src/commitment.rs @@ -11,7 +11,8 @@ pub fn commitment_arg<'a, 'b>() -> Arg<'a, 'b> { Arg::with_name(COMMITMENT_ARG.name) .long(COMMITMENT_ARG.long) .takes_value(true) - .possible_values(&["default", "max", "recent", "root"]) + .possible_values(&["recent", "root", "max"]) + .default_value("recent") .value_name("COMMITMENT_LEVEL") .help(COMMITMENT_ARG.help) } diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 909b4bdccf..62c036573f 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -155,14 +155,7 @@ impl ClusterQuerySubCommands for App<'_, '_> { .default_value("15") .help("Wait up to timeout seconds for transaction confirmation"), ) - .arg( - Arg::with_name(COMMITMENT_ARG.name) - .long(COMMITMENT_ARG.long) - .takes_value(true) - .possible_values(&["default", "max", "recent", "root"]) - .value_name("COMMITMENT_LEVEL") - .help("Wait until the transaction is confirmed at selected commitment level"), - ), + .arg(commitment_arg()), ) .subcommand( SubCommand::with_name("live-slots") @@ -252,8 +245,7 @@ pub fn parse_cluster_ping( None }; let timeout = Duration::from_secs(value_t_or_exit!(matches, "timeout", u64)); - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::Ping { lamports, @@ -280,8 +272,7 @@ pub fn parse_get_block_time(matches: &ArgMatches<'_>) -> Result) -> Result { - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::GetEpochInfo { commitment_config }, signers: vec![], @@ -289,8 +280,7 @@ pub fn parse_get_epoch_info(matches: &ArgMatches<'_>) -> Result) -> Result { - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::GetSlot { commitment_config }, signers: vec![], @@ -298,8 +288,7 @@ pub fn parse_get_slot(matches: &ArgMatches<'_>) -> Result) -> Result { - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::GetEpoch { commitment_config }, signers: vec![], @@ -307,8 +296,7 @@ pub fn parse_get_epoch(matches: &ArgMatches<'_>) -> Result) -> Result { - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::GetTransactionCount { commitment_config }, signers: vec![], @@ -334,8 +322,7 @@ pub fn parse_show_stakes( pub fn parse_show_validators(matches: &ArgMatches<'_>) -> Result { let use_lamports_unit = matches.is_present("lamports"); - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::ShowValidators { diff --git a/cli/src/vote.rs b/cli/src/vote.rs index bd7779f013..cae7019a9e 100644 --- a/cli/src/vote.rs +++ b/cli/src/vote.rs @@ -319,8 +319,7 @@ pub fn parse_vote_get_account_command( let vote_account_pubkey = pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap(); let use_lamports_unit = matches.is_present("lamports"); - let commitment_config = - commitment_of(matches, COMMITMENT_ARG.long).unwrap_or_else(CommitmentConfig::recent); + let commitment_config = commitment_of(matches, COMMITMENT_ARG.long).unwrap(); Ok(CliCommandInfo { command: CliCommand::ShowVoteAccount { pubkey: vote_account_pubkey,