Skip to content

Commit

Permalink
allows gossip pull requests with new contact-info (solana-labs#803)
Browse files Browse the repository at this point in the history
Current code is only allowing gossip pull requests with legacy
contact-info:
https://github.com/anza-xyz/agave/blob/8c5a33a81/gossip/src/cluster_info.rs#L1958-L1966

Working towards migrating to the new contact-info, the commit allows
gossip pull requests with both legacy and new contact-infos.
  • Loading branch information
behzadnouri authored Apr 15, 2024
1 parent 180a186 commit 50f1028
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1961,14 +1961,17 @@ impl ClusterInfo {
requests
.into_par_iter()
.with_min_len(1024)
.filter(|(_, _, caller)| match caller.contact_info() {
None => false,
Some(caller) if caller.pubkey() == &self_pubkey => {
warn!("PullRequest ignored, I'm talking to myself");
self.stats.window_request_loopback.add_relaxed(1);
false
.filter(|(_, _, caller)| match &caller.data {
CrdsData::LegacyContactInfo(_) | CrdsData::ContactInfo(_) => {
if caller.pubkey() == self_pubkey {
warn!("PullRequest ignored, I'm talking to myself");
self.stats.window_request_loopback.add_relaxed(1);
false
} else {
true
}
}
Some(_) => true,
_ => false,
})
.map(|(from_addr, filter, caller)| PullData {
from_addr,
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/crds_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl CrdsValue {
CrdsData::RestartHeaviestFork(_) => CrdsValueLabel::RestartHeaviestFork(self.pubkey()),
}
}
pub fn contact_info(&self) -> Option<&LegacyContactInfo> {
pub(crate) fn contact_info(&self) -> Option<&LegacyContactInfo> {
match &self.data {
CrdsData::LegacyContactInfo(contact_info) => Some(contact_info),
_ => None,
Expand Down

0 comments on commit 50f1028

Please sign in to comment.