From 246fe45d4908c79e733b7290176315169f42785c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:36:04 +0000 Subject: [PATCH] v2.0: removes early return if prune_messages are empty (backport of #3006) (#3011) removes early return if prune_messages are empty (#3006) Even if there are no outgoing prune messages we still need to generate outgoing push messages for packets just received, so the code should not early return here: https://github.com/anza-xyz/agave/blob/d2cc71f0d/gossip/src/cluster_info.rs#L2400-L2402 (cherry picked from commit ce158213fd050b5ccd89bf0857cd06a4584069f6) Co-authored-by: behzad nouri --- gossip/src/cluster_info.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 7c1dd11dd3d943..c50f4ff76043d2 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -2412,9 +2412,6 @@ impl ClusterInfo { .collect() }) }; - if prune_messages.is_empty() { - return; - } let mut packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests( recycler, "handle_batch_push_messages", @@ -2444,7 +2441,9 @@ impl ClusterInfo { self.stats .packets_sent_push_messages_count .add_relaxed((packet_batch.len() - num_prune_packets) as u64); - let _ = response_sender.send(packet_batch); + if !packet_batch.is_empty() { + let _ = response_sender.send(packet_batch); + } } fn require_stake_for_gossip(&self, stakes: &HashMap) -> bool {