Check and unwrap() Option instead of .iter().for_each() (#21072)
This commit is contained in:
parent
91c49d7023
commit
1453fce6c6
|
@ -1150,13 +1150,15 @@ mod with_incremental_snapshots {
|
||||||
cluster_info: &ClusterInfo,
|
cluster_info: &ClusterInfo,
|
||||||
validator_config: &ValidatorConfig,
|
validator_config: &ValidatorConfig,
|
||||||
) -> HashMap<(Slot, Hash), HashSet<(Slot, Hash)>> {
|
) -> HashMap<(Slot, Hash), HashSet<(Slot, Hash)>> {
|
||||||
|
if validator_config.trusted_validators.is_none() {
|
||||||
|
trace!("no trusted validators, so no trusted snapshot hashes");
|
||||||
|
return HashMap::new();
|
||||||
|
}
|
||||||
|
let trusted_validators = validator_config.trusted_validators.as_ref().unwrap();
|
||||||
|
|
||||||
let mut trusted_snapshot_hashes: HashMap<(Slot, Hash), HashSet<(Slot, Hash)>> =
|
let mut trusted_snapshot_hashes: HashMap<(Slot, Hash), HashSet<(Slot, Hash)>> =
|
||||||
HashMap::new();
|
HashMap::new();
|
||||||
validator_config
|
trusted_validators
|
||||||
.trusted_validators
|
|
||||||
.iter()
|
|
||||||
.for_each(|trusted_validators| {
|
|
||||||
trusted_validators
|
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|trusted_validator| {
|
.for_each(|trusted_validator| {
|
||||||
if let Some(crds_value::IncrementalSnapshotHashes {base: full_snapshot_hash, hashes: incremental_snapshot_hashes, ..}) = cluster_info.get_incremental_snapshot_hashes_for_node(trusted_validator) {
|
if let Some(crds_value::IncrementalSnapshotHashes {base: full_snapshot_hash, hashes: incremental_snapshot_hashes, ..}) = cluster_info.get_incremental_snapshot_hashes_for_node(trusted_validator) {
|
||||||
|
@ -1197,8 +1199,7 @@ mod with_incremental_snapshots {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
|
||||||
|
|
||||||
trace!("trusted snapshot hashes: {:?}", &trusted_snapshot_hashes);
|
trace!("trusted snapshot hashes: {:?}", &trusted_snapshot_hashes);
|
||||||
trusted_snapshot_hashes
|
trusted_snapshot_hashes
|
||||||
|
|
Loading…
Reference in New Issue