More gossipsub metrics (#6873)

N/A


  Add metrics that tell us if a duplicate message that we received was from a mesh peer or from a non mesh peer that we requested with iwant message.
This commit is contained in:
Pawan Dhananjay
2025-01-29 11:42:10 -08:00
committed by GitHub
parent 6973184b06
commit e7ea69647a
3 changed files with 63 additions and 0 deletions

View File

@@ -41,6 +41,13 @@ impl GossipPromises {
self.promises.contains_key(message)
}
/// Returns true if the message id exists in the promises and contains the given peer.
pub(crate) fn contains_peer(&self, message: &MessageId, peer: &PeerId) -> bool {
self.promises
.get(message)
.is_some_and(|peers| peers.contains_key(peer))
}
///Get the peers we sent IWANT the input message id.
pub(crate) fn peers_for_message(&self, message_id: &MessageId) -> Vec<PeerId> {
self.promises