Skip to content

Commit

Permalink
NetRpcImpl::get_peers return Remoteaddress.addresses dedup
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Jan 22, 2025
1 parent b44d2d2 commit dc8b4ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/src/module/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use ckb_systemtime::unix_time_as_millis;
use ckb_types::prelude::{Pack, Unpack};
use jsonrpc_core::Result;
use jsonrpc_utils::rpc;
use std::collections::HashSet;
use std::sync::Arc;

const MAX_ADDRS: usize = 50;
Expand Down Expand Up @@ -586,7 +587,7 @@ impl NetRpc for NetRpcImpl {
.connected_peers()
.iter()
.map(|(peer_index, peer)| {
let mut addresses = vec![&peer.connected_addr];
let mut addresses: HashSet<_> = vec![&peer.connected_addr].into_iter().collect();
addresses.extend(peer.listened_addrs.iter());

let node_addresses = addresses
Expand Down

0 comments on commit dc8b4ec

Please sign in to comment.