diff --git a/binaries/cuprated/src/rpc/json.rs b/binaries/cuprated/src/rpc/json.rs index 8b78d79..7e4e59e 100644 --- a/binaries/cuprated/src/rpc/json.rs +++ b/binaries/cuprated/src/rpc/json.rs @@ -552,7 +552,7 @@ async fn set_bans( // let [a, b, c, d] = peer.ip.to_le_bytes(); let ip = Ipv4Addr::new(a, b, c, d); - let address = SocketAddr::V4(SocketAddrV4::new(ip, todo!("p2p port?"))); + let address = SocketAddr::V4(SocketAddrV4::new(ip, 0)); let ban = if peer.ban { Some(Duration::from_secs(peer.seconds.into())) @@ -579,7 +579,7 @@ async fn get_bans(state: CupratedRpcHandler, _: GetBansRequest) -> Result(&mut DummyAddressBook) .await? .into_iter() - .map(|ban| { + .filter_map(|ban| { let seconds = if let Some(instant) = ban.unban_instant { instant .checked_duration_since(now) @@ -594,14 +594,14 @@ async fn get_bans(state: CupratedRpcHandler, _: GetBansRequest) -> Result let ip = match ban.address.ip() { IpAddr::V4(v4) => u32::from_le_bytes(v4.octets()), - IpAddr::V6(v6) => todo!(), + IpAddr::V6(v6) => return None, }; - GetBan { + Some(GetBan { host: ban.address.to_string(), ip, seconds, - } + }) }) .collect();