allows gossip pull requests with new contact-info (#803)

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.
This commit is contained in:
behzad nouri 2024-04-15 17:37:26 +00:00 committed by GitHub
parent 180a186c7d
commit 50f10284bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View File

@ -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,

View File

@ -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,