excludes origin from prune set (#13204)
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.
This commit is contained in:
parent
0f05e086fe
commit
be80f6d5c5
|
@ -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_PUSH_MSG_TIMEOUT_MS: u64 = 30000;
|
||||||
pub const CRDS_GOSSIP_PRUNE_MSG_TIMEOUT_MS: u64 = 500;
|
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_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.
|
// Do not push to peers which have not been updated for this long.
|
||||||
const PUSH_ACTIVE_TIMEOUT_MS: u64 = 60_000;
|
const PUSH_ACTIVE_TIMEOUT_MS: u64 = 60_000;
|
||||||
|
|
||||||
|
@ -136,8 +136,12 @@ impl CrdsGossipPush {
|
||||||
|
|
||||||
let mut keep = HashSet::new();
|
let mut keep = HashSet::new();
|
||||||
let mut peer_stake_sum = 0;
|
let mut peer_stake_sum = 0;
|
||||||
|
keep.insert(*origin);
|
||||||
for next in shuffle {
|
for next in shuffle {
|
||||||
let (next_peer, next_stake) = staked_peers[next];
|
let (next_peer, next_stake) = staked_peers[next];
|
||||||
|
if next_peer == *origin {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
keep.insert(next_peer);
|
keep.insert(next_peer);
|
||||||
peer_stake_sum += next_stake;
|
peer_stake_sum += next_stake;
|
||||||
if peer_stake_sum >= prune_stake_threshold
|
if peer_stake_sum >= prune_stake_threshold
|
||||||
|
|
Loading…
Reference in New Issue