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()
|
.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);
|
let _st = ScopedTimer::from(&self.stats.handle_batch_prune_messages_time);
|
||||||
if messages.is_empty() {
|
if messages.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
@ -1808,22 +1808,19 @@ impl ClusterInfo {
|
||||||
self.stats
|
self.stats
|
||||||
.prune_message_count
|
.prune_message_count
|
||||||
.add_relaxed(messages.len() as u64);
|
.add_relaxed(messages.len() as u64);
|
||||||
self.stats.prune_message_len.add_relaxed(
|
self.stats
|
||||||
messages
|
.prune_message_len
|
||||||
.iter()
|
.add_relaxed(messages.iter().map(|data| data.prunes.len() as u64).sum());
|
||||||
.map(|(_, data)| data.prunes.len() as u64)
|
|
||||||
.sum(),
|
|
||||||
);
|
|
||||||
let mut prune_message_timeout = 0;
|
let mut prune_message_timeout = 0;
|
||||||
let mut bad_prune_destination = 0;
|
let mut bad_prune_destination = 0;
|
||||||
let self_pubkey = self.id();
|
let self_pubkey = self.id();
|
||||||
{
|
{
|
||||||
let _st = ScopedTimer::from(&self.stats.process_prune);
|
let _st = ScopedTimer::from(&self.stats.process_prune);
|
||||||
let now = timestamp();
|
let now = timestamp();
|
||||||
for (from, data) in messages {
|
for data in messages {
|
||||||
match self.gossip.process_prune_msg(
|
match self.gossip.process_prune_msg(
|
||||||
&self_pubkey,
|
&self_pubkey,
|
||||||
&from,
|
&data.pubkey,
|
||||||
&data.destination,
|
&data.destination,
|
||||||
&data.prunes,
|
&data.prunes,
|
||||||
data.wallclock,
|
data.wallclock,
|
||||||
|
@ -2423,7 +2420,7 @@ impl ClusterInfo {
|
||||||
check_duplicate_instance(&data)?;
|
check_duplicate_instance(&data)?;
|
||||||
push_messages.push((from, 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::PingMessage(ping) => ping_messages.push((from_addr, ping)),
|
||||||
Protocol::PongMessage(pong) => pong_messages.push((from_addr, pong)),
|
Protocol::PongMessage(pong) => pong_messages.push((from_addr, pong)),
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,11 +157,9 @@ impl CrdsGossip {
|
||||||
wallclock: u64,
|
wallclock: u64,
|
||||||
now: u64,
|
now: u64,
|
||||||
) -> Result<(), CrdsGossipError> {
|
) -> Result<(), CrdsGossipError> {
|
||||||
let expired = now > wallclock + self.push.prune_timeout;
|
if now > wallclock.saturating_add(self.push.prune_timeout) {
|
||||||
if expired {
|
Err(CrdsGossipError::PruneMessageTimeout)
|
||||||
return Err(CrdsGossipError::PruneMessageTimeout);
|
} else if self_pubkey == destination {
|
||||||
}
|
|
||||||
if self_pubkey == destination {
|
|
||||||
self.push.process_prune_msg(self_pubkey, peer, origin);
|
self.push.process_prune_msg(self_pubkey, peer, origin);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -242,7 +242,12 @@ impl CrdsGossipPush {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add the `from` to the peer's filter of nodes.
|
/// 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) {
|
if let Some(filter) = self.active_set.read().unwrap().get(peer) {
|
||||||
for origin in origins {
|
for origin in origins {
|
||||||
if origin != self_pubkey {
|
if origin != self_pubkey {
|
||||||
|
|
Loading…
Reference in New Issue