diff --git a/portalnet/src/discovery.rs b/portalnet/src/discovery.rs index 44276da15..0315a12d1 100644 --- a/portalnet/src/discovery.rs +++ b/portalnet/src/discovery.rs @@ -418,7 +418,7 @@ impl Discv5UdpSocket { } /// A wrapper around `Enr` that implements `ConnectionPeer`. -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct UtpEnr(pub Enr); impl UtpEnr { @@ -433,6 +433,16 @@ impl UtpEnr { } } +impl std::fmt::Debug for UtpEnr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let peer_client_type = self.client().unwrap_or_else(|| "Unknown".to_string()); + f.debug_struct("UtpEnr") + .field("enr", &self.0) + .field("Peer Client Type", &peer_client_type) + .finish() + } +} + // Why are we implementing Hash, PartialEq, Eq for UtpEnr? // UtpEnr is used as an element of the key for a Connections HashTable in our uTP library. // Enr's can change and are not stable, so if we initiate a ``connect_with_cid`` we are inserting