diff --git a/p2p/src/msg.rs b/p2p/src/msg.rs index 7c68ae468..6a406fa2b 100644 --- a/p2p/src/msg.rs +++ b/p2p/src/msg.rs @@ -314,6 +314,7 @@ impl Readable for GetPeerAddrs { /// Peer addresses we know of that are fresh enough, in response to /// GetPeerAddrs. +#[derive(Debug)] pub struct PeerAddrs { pub peers: Vec, } @@ -375,6 +376,7 @@ impl Readable for PeerError { /// Only necessary so we can implement Readable and Writeable. Rust disallows /// implementing traits when both types are outside of this crate (which is the /// case for SocketAddr and Readable/Writeable). +#[derive(Debug)] pub struct SockAddr(pub SocketAddr); impl Writeable for SockAddr { diff --git a/p2p/src/store.rs b/p2p/src/store.rs index 4958f9551..ed393b5de 100644 --- a/p2p/src/store.rs +++ b/p2p/src/store.rs @@ -130,7 +130,7 @@ impl PeerStore { } /// List all known peers - /// Used for /v1/peers, for seed / sync (debug & if too few peers connected) + /// Used for /v1/peers/all api endpoint pub fn all_peers(&self) -> Vec { self.db .iter::(&to_key(PEER_PREFIX, &mut "".to_string().into_bytes())) @@ -155,5 +155,5 @@ impl PeerStore { } fn peer_key(peer_addr: SocketAddr) -> Vec { - to_key(PEER_PREFIX, &mut format!("{}", peer_addr.ip()).into_bytes()) + to_key(PEER_PREFIX, &mut format!("{}:{}", peer_addr.ip(), peer_addr.port()).into_bytes()) }