Skip to content

Commit

Permalink
some minor error messages corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Lykov committed Feb 24, 2023
1 parent c34fc08 commit df748f2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bench-tps/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,22 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {
args.multi_client = !matches.is_present("no-multi-client");
args.target_node = matches
.value_of("target_node")
.map(|target_str| target_str.parse::<Pubkey>().unwrap());
.map(|target_str| target_str.parse::<Pubkey>())
.transpose()
.map_err(|_| "Failed to parse target-node")?;

if let Some(v) = matches.value_of("num_lamports_per_account") {
args.num_lamports_per_account =
v.to_string().parse().map_err(|_| "can't parse lamports")?;
args.num_lamports_per_account = v
.to_string()
.parse()
.map_err(|_| "can't parse num-lamports-per-account")?;
}

if let Some(t) = matches.value_of("target_slots_per_epoch") {
args.target_slots_per_epoch = t
.to_string()
.parse()
.map_err(|_| "can't parse target slots per epoch")?;
.map_err(|_| "can't parse target-slots-per-epoch")?;
}

if matches.is_present("use_randomized_compute_unit_price") {
Expand Down Expand Up @@ -535,13 +539,13 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {
if let Some(num_conflict_groups) = matches.value_of("num_conflict_groups") {
let parsed_num_conflict_groups = num_conflict_groups
.parse()
.map_err(|_| "Can't parse conflict groups")?;
.map_err(|_| "Can't parse num-conflict-groups")?;
args.num_conflict_groups = Some(parsed_num_conflict_groups);
}

if let Some(addr) = matches.value_of("bind_address") {
args.bind_address =
solana_net_utils::parse_host(addr).map_err(|_| "Failed to parse bind_address")?;
solana_net_utils::parse_host(addr).map_err(|_| "Failed to parse bind-address")?;
}

if let Some(client_node_id_filename) = matches.value_of("client_node_id") {
Expand Down

0 comments on commit df748f2

Please sign in to comment.