Unverified Commit c7bfca18 authored by Robert Klotzner's avatar Robert Klotzner Committed by GitHub
Browse files

Raised nits on #3813 (#3844)

parent 1c1c37fc
Pipeline #157576 passed with stages
in 43 minutes and 50 seconds
......@@ -43,11 +43,11 @@ pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
/// Take an active subset of a set containing all validators.
///
/// First item in pair will be all items in set have indeces found in the `active` indices set (in
/// First item in pair will be all items in set have indices found in the `active` indices set (in
/// the order of the `active` vec, the second item will contain the rest, in the original order.
///
/// ```ignore
/// split_active_subset(active.into_iter().collect(), all).0 == take_active_subset(active, all)
/// split_active_subset(active, all).0 == take_active_subset(active, all)
/// ```
pub fn split_active_subset<T: Clone>(active: &[ValidatorIndex], all: &[T]) -> (Vec<T>, Vec<T>) {
let active_set: BTreeSet<_> = active.iter().cloned().collect();
......@@ -73,6 +73,10 @@ pub fn split_active_subset<T: Clone>(active: &[ValidatorIndex], all: &[T]) -> (V
}
/// Uses `split_active_subset` and concatenates the inactive to the active vec.
///
/// ```ignore
/// split_active_subset(active, all)[0..active.len()]) == take_active_subset(active, all)
/// ```
pub fn take_active_subset_and_inactive<T: Clone>(active: &[ValidatorIndex], all: &[T]) -> Vec<T> {
let (mut a, mut i) = split_active_subset(active, all);
a.append(&mut i);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment