Skip to content

Commit

Permalink
report received message signatures only on PUSH requests (#32708)
Browse files Browse the repository at this point in the history
* we only want to report received message signatures on PUSH requests, not PULL requests

* woops accidently had it has LocalMessage not PushMessage

* switch from match to if let statement

* convert if let to matches macro
  • Loading branch information
gregcusack authored Aug 7, 2023
1 parent dbe6d03 commit 8495257
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gossip/src/crds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ impl Default for CrdsDataStats {
}

impl CrdsDataStats {
fn record_insert(&mut self, entry: &VersionedCrdsValue) {
fn record_insert(&mut self, entry: &VersionedCrdsValue, route: GossipRoute) {
self.counts[Self::ordinal(entry)] += 1;
if let CrdsData::Vote(_, vote) = &entry.value.data {
if let Some(slot) = vote.slot() {
Expand All @@ -678,7 +678,9 @@ impl CrdsDataStats {
}
}

if should_report_message_signature(&entry.value.signature) {
if matches!(route, GossipRoute::PushMessage)
&& should_report_message_signature(&entry.value.signature)
{
datapoint_info!(
"gossip_crds_sample",
(
Expand Down Expand Up @@ -723,8 +725,8 @@ impl CrdsStats {
match route {
GossipRoute::LocalMessage => (),
GossipRoute::PullRequest => (),
GossipRoute::PushMessage => self.push.record_insert(entry),
GossipRoute::PullResponse => self.pull.record_insert(entry),
GossipRoute::PushMessage => self.push.record_insert(entry, route),
GossipRoute::PullResponse => self.pull.record_insert(entry, route),
}
}

Expand Down

0 comments on commit 8495257

Please sign in to comment.