diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 636ad3970..4875cb700 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -2725,9 +2725,9 @@ impl ClusterInfo { .unwrap() } - pub fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr, shred_version: u16) -> ContactInfo { + pub fn gossip_contact_info(id: Pubkey, gossip: SocketAddr, shred_version: u16) -> ContactInfo { ContactInfo { - id: *id, + id, gossip, wallclock: timestamp(), shred_version, @@ -2737,7 +2737,7 @@ impl ClusterInfo { /// An alternative to Spy Node that has a valid gossip address and fully participate in Gossip. pub fn gossip_node( - id: &Pubkey, + id: Pubkey, gossip_addr: &SocketAddr, shred_version: u16, ) -> (ContactInfo, UdpSocket, Option) { @@ -2752,7 +2752,7 @@ impl ClusterInfo { /// A Node with dummy ports to spy on gossip via pull requests pub fn spy_node( - id: &Pubkey, + id: Pubkey, shred_version: u16, ) -> (ContactInfo, UdpSocket, Option) { let bind_ip_addr = IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)); @@ -3141,10 +3141,10 @@ mod tests { #[test] fn test_gossip_node() { //check that a gossip nodes always show up as spies - let (node, _, _) = ClusterInfo::spy_node(&solana_sdk::pubkey::new_rand(), 0); + let (node, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0); assert!(ClusterInfo::is_spy_node(&node)); let (node, _, _) = ClusterInfo::gossip_node( - &solana_sdk::pubkey::new_rand(), + solana_sdk::pubkey::new_rand(), &"1.1.1.1:1111".parse().unwrap(), 0, ); @@ -3424,7 +3424,7 @@ mod tests { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); //check that gossip doesn't try to push to invalid addresses let node = Node::new_localhost(); - let (spy, _, _) = ClusterInfo::spy_node(&solana_sdk::pubkey::new_rand(), 0); + let (spy, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0); let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(node.info)); cluster_info.insert_info(spy); cluster_info diff --git a/gossip/src/gossip_service.rs b/gossip/src/gossip_service.rs index 04042ef5c..73ea8b607 100644 --- a/gossip/src/gossip_service.rs +++ b/gossip/src/gossip_service.rs @@ -303,9 +303,9 @@ fn make_gossip_node( should_check_duplicate_instance: bool, ) -> (GossipService, Option, Arc) { let (node, gossip_socket, ip_echo) = if let Some(gossip_addr) = gossip_addr { - ClusterInfo::gossip_node(&keypair.pubkey(), gossip_addr, shred_version) + ClusterInfo::gossip_node(keypair.pubkey(), gossip_addr, shred_version) } else { - ClusterInfo::spy_node(&keypair.pubkey(), shred_version) + ClusterInfo::spy_node(keypair.pubkey(), shred_version) }; let cluster_info = ClusterInfo::new(node, keypair); if let Some(entrypoint) = entrypoint { diff --git a/validator/src/main.rs b/validator/src/main.rs index a2bf791cd..54ebc61a2 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -360,7 +360,7 @@ fn start_gossip_node( ) -> (Arc, Arc, GossipService) { let mut cluster_info = ClusterInfo::new( ClusterInfo::gossip_contact_info( - &identity_keypair.pubkey(), + identity_keypair.pubkey(), *gossip_addr, expected_shred_version.unwrap_or(0), ),