From 6a4f89b1936c54fefc968a5236584a7ff7a7a4bc Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2020 15:22:47 +0000 Subject: [PATCH] excludes origin from prune set (#13204) (#13278) On the receiving end, prune messages are ignored if the origin points to the node itself: https://github.com/solana-labs/solana/blob/631f029fe/core/src/crds_gossip_push.rs#L285-L295 So to avoid sending these over the wire, the requester can exclude origin from the prune set. (cherry picked from commit be80f6d5c5fe85f91bd3be195d40c0499a93b307) Co-authored-by: behzad nouri --- core/src/crds_gossip_push.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/crds_gossip_push.rs b/core/src/crds_gossip_push.rs index 264986d7bd..20e3700c7f 100644 --- a/core/src/crds_gossip_push.rs +++ b/core/src/crds_gossip_push.rs @@ -35,7 +35,7 @@ pub const CRDS_GOSSIP_PUSH_FANOUT: usize = 6; pub const CRDS_GOSSIP_PUSH_MSG_TIMEOUT_MS: u64 = 30000; pub const CRDS_GOSSIP_PRUNE_MSG_TIMEOUT_MS: u64 = 500; pub const CRDS_GOSSIP_PRUNE_STAKE_THRESHOLD_PCT: f64 = 0.15; -pub const CRDS_GOSSIP_PRUNE_MIN_INGRESS_NODES: usize = 2; +pub const CRDS_GOSSIP_PRUNE_MIN_INGRESS_NODES: usize = 3; // Do not push to peers which have not been updated for this long. const PUSH_ACTIVE_TIMEOUT_MS: u64 = 60_000; @@ -136,8 +136,12 @@ impl CrdsGossipPush { let mut keep = HashSet::new(); let mut peer_stake_sum = 0; + keep.insert(*origin); for next in shuffle { let (next_peer, next_stake) = staked_peers[next]; + if next_peer == *origin { + continue; + } keep.insert(next_peer); peer_stake_sum += next_stake; if peer_stake_sum >= prune_stake_threshold