Skip to content

Commit

Permalink
CLI remove unwrap_or_default() on rpc calls (#33782)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arrowana authored Oct 20, 2023
1 parent 092c213 commit e1a9f8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
26 changes: 10 additions & 16 deletions cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1886,23 +1886,17 @@ pub fn process_show_validators(

progress_bar.set_message("Fetching block production...");
let skip_rate: HashMap<_, _> = rpc_client
.get_block_production()
.ok()
.map(|result| {
result
.value
.by_identity
.into_iter()
.map(|(identity, (leader_slots, blocks_produced))| {
(
identity,
100. * (leader_slots.saturating_sub(blocks_produced)) as f64
/ leader_slots as f64,
)
})
.collect()
.get_block_production()?
.value
.by_identity
.into_iter()
.map(|(identity, (leader_slots, blocks_produced))| {
(
identity,
100. * (leader_slots.saturating_sub(blocks_produced)) as f64 / leader_slots as f64,
)
})
.unwrap_or_default();
.collect();

progress_bar.set_message("Fetching version information...");
let mut node_version = HashMap::new();
Expand Down
3 changes: 1 addition & 2 deletions cli/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,7 @@ fn process_status(
let mut features = vec![];
for feature_ids in feature_ids.chunks(MAX_MULTIPLE_ACCOUNTS) {
let mut feature_chunk = rpc_client
.get_multiple_accounts(feature_ids)
.unwrap_or_default()
.get_multiple_accounts(feature_ids)?
.into_iter()
.zip(feature_ids)
.map(|(account, feature_id)| {
Expand Down

0 comments on commit e1a9f8e

Please sign in to comment.