Skip to content

Commit b8dd93b

Browse files
committed
address Diego's review
1 parent 613b681 commit b8dd93b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

protocols/gossipsub/src/behaviour.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub enum Event {
165165
failed_messages: FailedMessages,
166166
},
167167
/// A Peer is below the score threshold.
168-
LowScorePeers { peer_ids: Vec<PeerId> },
168+
BelowThresholdPeers { peer_ids: Vec<PeerId> },
169169
}
170170

171171
/// A data structure for storing configuration for publishing messages. See [`MessageAuthenticity`]
@@ -2191,7 +2191,7 @@ where
21912191

21922192
if !peers_to_report.is_empty() {
21932193
self.events
2194-
.push_back(ToSwarm::GenerateEvent(Event::LowScorePeers {
2194+
.push_back(ToSwarm::GenerateEvent(Event::BelowThresholdPeers {
21952195
peer_ids: peers_to_report,
21962196
}));
21972197
}

protocols/gossipsub/src/behaviour/tests.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6826,11 +6826,16 @@ fn test_low_score_peer_is_reported() {
68266826
let low_score_event = gs
68276827
.events
68286828
.iter()
6829-
.find(|event| matches!(event, ToSwarm::GenerateEvent(Event::LowScorePeers { .. })))
6829+
.find(|event| {
6830+
matches!(
6831+
event,
6832+
ToSwarm::GenerateEvent(Event::BelowThresholdPeers { .. })
6833+
)
6834+
})
68306835
.unwrap();
68316836

68326837
match low_score_event {
6833-
ToSwarm::GenerateEvent(Event::LowScorePeers { peer_ids }) => {
6838+
ToSwarm::GenerateEvent(Event::BelowThresholdPeers { peer_ids }) => {
68346839
assert_eq!(peer_ids.len(), 2);
68356840
assert!(peer_ids.contains(&peers[0]));
68366841
assert!(peer_ids.contains(&peers[1]));

0 commit comments

Comments
 (0)