Compare commits

..

1 Commits

Author SHA1 Message Date
durch 31c6090576 Construct test routes from good nodes only 2022-04-03 20:11:06 +02:00
2 changed files with 20 additions and 19 deletions
+9 -17
View File
@@ -131,13 +131,9 @@ impl<C> ValidatorCacheRefresher<C> {
self.nymd_client.get_gateways(),
)?;
let (rewarded_set, active_set) = if let Ok(rewarded_set_identities) =
self.nymd_client.get_rewarded_set_identities().await
{
self.collect_rewarded_and_active_set_details(&mixnodes, rewarded_set_identities)
} else {
(Vec::new(), Vec::new())
};
let rewarded_set_identities = self.nymd_client.get_rewarded_set_identities().await?;
let (rewarded_set, active_set) =
self.collect_rewarded_and_active_set_details(&mixnodes, rewarded_set_identities);
let epoch_rewarding_params = self.nymd_client.get_current_epoch_reward_params().await?;
@@ -158,19 +154,15 @@ impl<C> ValidatorCacheRefresher<C> {
.await;
if let Some(notify) = &self.update_rewarded_set_notify {
if let Ok(update_details) = self
let update_details = self
.nymd_client
.get_current_rewarded_set_update_details()
.await
.await?;
if update_details.last_refreshed_block + (update_details.refresh_rate_blocks as u64)
< update_details.current_height
{
if update_details.last_refreshed_block + (update_details.refresh_rate_blocks as u64)
< update_details.current_height
{
// there's only ever a single waiter -> the set updater
notify.notify_one()
}
} else {
// This has the potential to be spammy, we'll find out
// there's only ever a single waiter -> the set updater
notify.notify_one()
}
}
@@ -229,7 +229,7 @@ impl PacketPreparer {
}
async fn all_mixnodes_and_gateways(&self) -> (Vec<MixNodeBond>, Vec<GatewayBond>) {
info!(target: "Monitor", "Obtaining network topology...");
info!(target: "Monitor", "Obtaining entire network topology...");
let mixnodes = self.validator_cache.mixnodes_all().await;
let gateways = self.validator_cache.gateways_all().await;
@@ -237,6 +237,15 @@ impl PacketPreparer {
(mixnodes, gateways)
}
async fn mixnodes_and_gateways(&self) -> (Vec<MixNodeBond>, Vec<GatewayBond>) {
info!(target: "Monitor", "Obtaining good network topology...");
let mixnodes = self.validator_cache.mixnodes().await;
let gateways = self.validator_cache.gateways().await;
(mixnodes, gateways)
}
pub(crate) fn try_parse_mix_bond(&self, mix: &MixNodeBond) -> Result<mix::Node, String> {
let identity = mix.mix_node.identity_key.clone();
if !self.check_version_compatibility(&mix.mix_node.version) {
@@ -266,7 +275,7 @@ impl PacketPreparer {
n: usize,
blacklist: &mut HashSet<String>,
) -> Option<Vec<TestRoute>> {
let (mixnodes, gateways) = self.all_mixnodes_and_gateways().await;
let (mixnodes, gateways) = self.mixnodes_and_gateways().await;
// separate mixes into layers for easier selection
let mut layered_mixes = HashMap::new();
for mix in mixnodes {