Compare commits

...

1 Commits

Author SHA1 Message Date
durch 6dbb3fbd3f Trigger rewarded_set update on bootstrap error 2022-03-30 14:35:03 +02:00
+14 -6
View File
@@ -131,9 +131,13 @@ impl<C> ValidatorCacheRefresher<C> {
self.nymd_client.get_gateways(), self.nymd_client.get_gateways(),
)?; )?;
let rewarded_set_identities = self.nymd_client.get_rewarded_set_identities().await?; let (rewarded_set, active_set) = if let Ok(rewarded_set_identities) =
let (rewarded_set, active_set) = self.nymd_client.get_rewarded_set_identities().await
self.collect_rewarded_and_active_set_details(&mixnodes, rewarded_set_identities); {
self.collect_rewarded_and_active_set_details(&mixnodes, rewarded_set_identities)
} else {
(Vec::new(), Vec::new())
};
let epoch_rewarding_params = self.nymd_client.get_current_epoch_reward_params().await?; let epoch_rewarding_params = self.nymd_client.get_current_epoch_reward_params().await?;
@@ -154,17 +158,21 @@ impl<C> ValidatorCacheRefresher<C> {
.await; .await;
if let Some(notify) = &self.update_rewarded_set_notify { if let Some(notify) = &self.update_rewarded_set_notify {
let update_details = self if let Ok(update_details) = self
.nymd_client .nymd_client
.get_current_rewarded_set_update_details() .get_current_rewarded_set_update_details()
.await?; .await
{
if update_details.last_refreshed_block + (update_details.refresh_rate_blocks as u64) if update_details.last_refreshed_block + (update_details.refresh_rate_blocks as u64)
< update_details.current_height < update_details.current_height
{ {
// there's only ever a single waiter -> the set updater // there's only ever a single waiter -> the set updater
notify.notify_one() notify.notify_one()
} }
} else {
// This has the potential to be spammy, we'll find out
notify.notify_one()
}
} }
Ok(()) Ok(())