Skip to content

Commit 009b318

Browse files
authored
Shuffle validator order in download_missing_sender_blocks (Backport of 4724) (linera-io#4725)
## Motivation Right now we're going through the validators always in the same order, which is not ideal ## Proposal Shuffle the validator order ## Test Plan CI
1 parent 93b0f13 commit 009b318

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

linera-core/src/client/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,14 +2228,15 @@ impl<Env: Environment> ChainClient<Env> {
22282228
stream::iter(missing_blocks.into_iter())
22292229
.map(|(sender_chain_id, heights)| {
22302230
let height = heights.into_iter().max();
2231-
let nodes = nodes.clone();
22322231
let this = self.clone();
2232+
let mut shuffled_nodes = nodes.clone();
2233+
shuffled_nodes.shuffle(&mut rand::thread_rng());
22332234
async move {
22342235
let Some(height) = height else {
22352236
return Ok(());
22362237
};
22372238
// Try to download from any node.
2238-
for node in &nodes {
2239+
for node in &shuffled_nodes {
22392240
if let Err(err) = this
22402241
.download_sender_block_with_sending_ancestors(
22412242
sender_chain_id,

0 commit comments

Comments
 (0)