Fixed compilation errors

This commit is contained in:
Jedrzej Stuczynski
2020-01-10 14:50:30 +00:00
parent 9d760a515a
commit 227f69befb
2 changed files with 84 additions and 109 deletions
+13 -15
View File
@@ -56,31 +56,29 @@ impl HealthCheckResult {
HealthCheckResult(health)
}
fn check_path(path: Vec<SphinxNode>) -> bool {
fn check_path(path: &Vec<SphinxNode>) -> bool {
trace!("Checking path: {:?}", path);
// TODO:
false
true
}
pub fn calculate<T: NymTopology>(topology: T) -> Self {
let all_paths = match current_topology.all_paths() {
let all_paths = match topology.all_paths() {
Ok(paths) => paths,
Err(_) => return Self::zero_score(topology),
};
// create entries for all nodes
let mut score_map = HashMap::new();
current_topology
.get_mix_nodes()
.into_iter()
.for_each(|node| {
score_map.insert(
NodeAddressBytes::from_b64_string(node.pub_key.clone()).0,
NodeScore::from_mixnode(node),
);
});
topology.get_mix_nodes().into_iter().for_each(|node| {
score_map.insert(
NodeAddressBytes::from_b64_string(node.pub_key.clone()).0,
NodeScore::from_mixnode(node),
);
});
current_topology
topology
.get_mix_provider_nodes()
.into_iter()
.for_each(|node| {
@@ -91,7 +89,7 @@ impl HealthCheckResult {
});
for path in all_paths {
let path_status = HealthCheckResult::check_path(path);
let path_status = HealthCheckResult::check_path(&path);
for node in path {
// if value doesn't exist, something extremely weird must have happened
let current_score = score_map.get_mut(&node.pub_key.0);
@@ -103,7 +101,7 @@ impl HealthCheckResult {
}
}
HealthCheckResult(score_map.values().collect())
HealthCheckResult(score_map.drain().map(|(k, v)| v).collect())
}
}