chore: use exact max full peer count or round (#10228)

This commit is contained in:
Matthias Seitz
2024-08-09 15:08:48 +02:00
committed by GitHub
parent e49f173f19
commit 66ddc5d8f4

View File

@ -421,7 +421,7 @@ where
// send full transactions to a fraction of the connected peers (square root of the total
// number of connected peers)
let max_num_full = (self.peers.len() as f64).sqrt() as usize + 1;
let max_num_full = (self.peers.len() as f64).sqrt().round() as usize;
// Note: Assuming ~random~ order due to random state of the peers map hasher
for (peer_idx, (peer_id, peer)) in self.peers.iter_mut().enumerate() {