ignores pubkey in Protocol::PruneMessage (#29280)
Protocol::PruneMessage(Pubkey, _) is the same as PruneData.pubkey and so is redundant and can be ignored: https://github.com/solana-labs/solana/blob/95d339300/gossip/src/cluster_info.rs#LL277-L279 https://github.com/solana-labs/solana/blob/95d339300/gossip/src/cluster_info.rs#L361-L367
This commit is contained in:
parent
50ad0390f9
commit
78a04ed432
|
@ -1800,7 +1800,7 @@ impl ClusterInfo {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
fn handle_batch_prune_messages(&self, messages: Vec<(Pubkey, PruneData)>) {
|
||||
fn handle_batch_prune_messages(&self, messages: Vec<PruneData>) {
|
||||
let _st = ScopedTimer::from(&self.stats.handle_batch_prune_messages_time);
|
||||
if messages.is_empty() {
|
||||
return;
|
||||
|
@ -1808,22 +1808,19 @@ impl ClusterInfo {
|
|||
self.stats
|
||||
.prune_message_count
|
||||
.add_relaxed(messages.len() as u64);
|
||||
self.stats.prune_message_len.add_relaxed(
|
||||
messages
|
||||
.iter()
|
||||
.map(|(_, data)| data.prunes.len() as u64)
|
||||
.sum(),
|
||||
);
|
||||
self.stats
|
||||
.prune_message_len
|
||||
.add_relaxed(messages.iter().map(|data| data.prunes.len() as u64).sum());
|
||||
let mut prune_message_timeout = 0;
|
||||
let mut bad_prune_destination = 0;
|
||||
let self_pubkey = self.id();
|
||||
{
|
||||
let _st = ScopedTimer::from(&self.stats.process_prune);
|
||||
let now = timestamp();
|
||||
for (from, data) in messages {
|
||||
for data in messages {
|
||||
match self.gossip.process_prune_msg(
|
||||
&self_pubkey,
|
||||
&from,
|
||||
&data.pubkey,
|
||||
&data.destination,
|
||||
&data.prunes,
|
||||
data.wallclock,
|
||||
|
@ -2423,7 +2420,7 @@ impl ClusterInfo {
|
|||
check_duplicate_instance(&data)?;
|
||||
push_messages.push((from, data));
|
||||
}
|
||||
Protocol::PruneMessage(from, data) => prune_messages.push((from, data)),
|
||||
Protocol::PruneMessage(_from, data) => prune_messages.push(data),
|
||||
Protocol::PingMessage(ping) => ping_messages.push((from_addr, ping)),
|
||||
Protocol::PongMessage(pong) => pong_messages.push((from_addr, pong)),
|
||||
}
|
||||
|
|
|
@ -157,11 +157,9 @@ impl CrdsGossip {
|
|||
wallclock: u64,
|
||||
now: u64,
|
||||
) -> Result<(), CrdsGossipError> {
|
||||
let expired = now > wallclock + self.push.prune_timeout;
|
||||
if expired {
|
||||
return Err(CrdsGossipError::PruneMessageTimeout);
|
||||
}
|
||||
if self_pubkey == destination {
|
||||
if now > wallclock.saturating_add(self.push.prune_timeout) {
|
||||
Err(CrdsGossipError::PruneMessageTimeout)
|
||||
} else if self_pubkey == destination {
|
||||
self.push.process_prune_msg(self_pubkey, peer, origin);
|
||||
Ok(())
|
||||
} else {
|
||||
|
|
|
@ -242,7 +242,12 @@ impl CrdsGossipPush {
|
|||
}
|
||||
|
||||
/// Add the `from` to the peer's filter of nodes.
|
||||
pub fn process_prune_msg(&self, self_pubkey: &Pubkey, peer: &Pubkey, origins: &[Pubkey]) {
|
||||
pub(crate) fn process_prune_msg(
|
||||
&self,
|
||||
self_pubkey: &Pubkey,
|
||||
peer: &Pubkey,
|
||||
origins: &[Pubkey],
|
||||
) {
|
||||
if let Some(filter) = self.active_set.read().unwrap().get(peer) {
|
||||
for origin in origins {
|
||||
if origin != self_pubkey {
|
||||
|
|
Loading…
Reference in New Issue