allow emtpy topology to be served
This commit is contained in:
@@ -102,14 +102,18 @@ impl NymApiTopologyProvider {
|
||||
|
||||
let topology = nym_topology_from_detailed(mixnodes, gateways)
|
||||
.with_epoch(current_epoch)
|
||||
.with_all_mixes(all_mixes)
|
||||
.with_all_gateways(all_gateways)
|
||||
.with_all_mixes(all_mixes.clone())
|
||||
.with_all_gateways(all_gateways.clone())
|
||||
.filter_system_version(&self.client_version);
|
||||
|
||||
if let Err(err) = self.check_layer_distribution(&topology) {
|
||||
warn!("The current filtered active topology has extremely skewed layer distribution. It cannot be used: {err}");
|
||||
self.use_next_nym_api();
|
||||
None
|
||||
let empty_topology = NymTopology::empty()
|
||||
.with_epoch(current_epoch)
|
||||
.with_all_mixes(all_mixes)
|
||||
.with_all_gateways(all_gateways);
|
||||
Some(empty_topology)
|
||||
} else {
|
||||
Some(topology)
|
||||
}
|
||||
|
||||
@@ -88,6 +88,16 @@ impl NymTopology {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn empty() -> Self {
|
||||
NymTopology {
|
||||
mixes: BTreeMap::new(),
|
||||
gateways: Vec::new(),
|
||||
epoch: 0,
|
||||
all_mixes: Vec::new(),
|
||||
all_gateways: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_epoch(mut self, epoch: EpochId) -> Self {
|
||||
self.epoch = epoch;
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user