From fc39425990d28a0229fb1df7dc500168437d971d Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Wed, 5 Jun 2024 15:53:39 -0500 Subject: [PATCH] patches ClusterInfo::spy_node --- gossip/src/cluster_info.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 0160927c3ae166..c2266e74f1f915 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -43,7 +43,6 @@ use { restart_crds_values::{ RestartHeaviestFork, RestartLastVotedForkSlots, RestartLastVotedForkSlotsError, }, - socketaddr, socketaddr_any, weighted_shuffle::WeightedShuffle, }, bincode::{serialize, serialized_size}, @@ -2807,9 +2806,12 @@ impl ClusterInfo { shred_version: u16, ) -> (ContactInfo, UdpSocket, Option) { let bind_ip_addr = IpAddr::V4(Ipv4Addr::UNSPECIFIED); - let (_, gossip_socket) = bind_in_range(bind_ip_addr, VALIDATOR_PORT_RANGE).unwrap(); - let contact_info = Self::gossip_contact_info(id, socketaddr_any!(), shred_version); - + let (port, gossip_socket) = bind_in_range(bind_ip_addr, VALIDATOR_PORT_RANGE).unwrap(); + let contact_info = Self::gossip_contact_info( + id, + SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port), + shred_version, + ); (contact_info, gossip_socket, None) } } @@ -3288,6 +3290,7 @@ mod tests { crds_gossip_pull::tests::MIN_NUM_BLOOM_FILTERS, crds_value::{AccountsHashes, CrdsValue, CrdsValueLabel, Vote as CrdsVote}, duplicate_shred::{self, tests::new_rand_shred, MAX_DUPLICATE_SHREDS}, + socketaddr, }, itertools::izip, solana_ledger::shred::Shredder,