Skip to content

Commit

Permalink
v1.18: allows gossip pull requests with new contact-info (backport of s…
Browse files Browse the repository at this point in the history
…olana-labs#803) (solana-labs#816)

allows gossip pull requests with new contact-info (solana-labs#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.

(cherry picked from commit 50f1028)

Co-authored-by: behzad nouri <[email protected]>
  • Loading branch information
mergify[bot] and behzadnouri authored Apr 15, 2024
1 parent 7e7810e commit 6f45ff2
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 @@ -1931,14 +1931,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 6f45ff2

Please sign in to comment.