mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 10:17:57 +00:00
bitfield dist logging cleanup and enhancements (#5147)
* split metrics from bitfield signing * cleanup all logging * add a unit test for subset generation * chore: add one more test to assert need is properly represented * u8 as usize * chore: overseer fixin * fix test * Update node/network/bitfield-distribution/src/metrics.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> * Update node/network/bitfield-distribution/src/metrics.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> * fallout from suggested rename * consistency Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
61a6004cf1
commit
6e3b5f1888
@@ -245,3 +245,14 @@ fn tick_tack_metronome() {
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn subset_generation_check() {
|
||||
let values = (0_u8..=25).collect::<Vec<_>>();
|
||||
// 12 even numbers exist
|
||||
let mut chosen = choose_random_subset::<u8, _>(|v| v & 0x01 == 0, values, 12);
|
||||
chosen.sort();
|
||||
for (idx, v) in dbg!(chosen).into_iter().enumerate() {
|
||||
assert_eq!(v as usize, idx * 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user