Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a random subset of validators in net_dynamic_hb #385

Merged
merged 10 commits into from
Feb 27, 2019
7 changes: 7 additions & 0 deletions tests/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,13 @@ where
self.nodes.remove(id)
}

/// Removes a set of nodes with the given IDs from the network and all messages addressed to
/// them. Returns the removed nodes if there were nodes with these IDs at the time of removal.
#[inline]
pub fn remove_nodes(&mut self, ids: &BTreeSet<D::NodeId>) -> Vec<Node<D>> {
ids.iter().filter_map(|id| self.remove_node(id)).collect()
}

/// Retrieve a node by ID.
///
/// Returns `None` if the node ID is not part of the network.
Expand Down
Loading