Skip to content

Commit beeb409

Browse files
committed
feat(transition_frontier/sync/ledger/snarked): randomize which peer is used for query
1 parent 324069f commit beeb409

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_reducer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use p2p::{
66
disconnection::{P2pDisconnectionAction, P2pDisconnectionReason},
77
PeerId,
88
};
9+
use rand::prelude::*;
910

1011
use crate::{
1112
ledger::{
@@ -54,7 +55,7 @@ impl TransitionFrontierSyncLedgerSnarkedState {
5455
.filter(|(_, p)| p.channels.rpc.can_send_request())
5556
.map(|(id, p)| (*id, p.connected_since))
5657
.collect::<Vec<_>>();
57-
peer_ids.sort_by(|(_, t1), (_, t2)| t2.cmp(t1));
58+
peer_ids.shuffle(&mut global_state.pseudo_rng());
5859

5960
if is_num_accounts_pending {
6061
for (peer_id, _) in peer_ids {

0 commit comments

Comments
 (0)