removes Rng field from WeightedShuffle struct (#22850) (#22868)

(cherry picked from commit 45e09664b8)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2022-02-01 17:33:52 +00:00
committed by GitHub
parent 3aa3cd8852
commit c715bc93cf
6 changed files with 44 additions and 46 deletions

View File

@ -411,8 +411,9 @@ fn enable_turbine_peers_shuffle_patch(shred_slot: Slot, root_bank: &Bank) -> boo
fn shuffle_nodes<'a, R: Rng>(rng: &mut R, nodes: &[&'a Node]) -> Vec<&'a Node> {
// Nodes are sorted by (stake, pubkey) in descending order.
let stakes: Vec<u64> = nodes.iter().map(|node| node.stake).collect();
WeightedShuffle::new(rng, &stakes)
WeightedShuffle::new(&stakes)
.unwrap()
.shuffle(rng)
.map(|i| nodes[i])
.collect()
}