From 3b8d6b59fb2ee979e9da4e79805175f8b5bf66c6 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Tue, 27 Apr 2021 12:06:49 +0000 Subject: [PATCH] records hash of values purged by expired pull-responses (#16800) process_pull_responses should record hash of values purged by expired responses (as well as unexpired ones): https://github.com/solana-labs/solana/blob/c1829dd00/core/src/crds_gossip_pull.rs#L385-L387 otherwise, these values are not excluded from following pull-requests (from likely different nodes): https://github.com/solana-labs/solana/blob/c1829dd00/core/src/crds_gossip_pull.rs#L447-L452 and would waste bandwidth should they be included in subsequent pull-responses. --- core/src/crds_gossip_pull.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/crds_gossip_pull.rs b/core/src/crds_gossip_pull.rs index 26092aff5e..fcb588778e 100644 --- a/core/src/crds_gossip_pull.rs +++ b/core/src/crds_gossip_pull.rs @@ -382,8 +382,10 @@ impl CrdsGossipPull { let mut owners = HashSet::new(); for r in responses_expired_timeout { let value_hash = r.value_hash; - if crds.insert_versioned(r).is_err() { - failed_inserts.push(value_hash); + match crds.insert_versioned(r) { + Ok(None) => (), + Ok(Some(old)) => self.purged_values.push_back((old.value_hash, now)), + Err(_) => failed_inserts.push(value_hash), } } for r in responses {