From 9ab27291f535aaf5b7523148369e14eb56066d18 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 15 Mar 2020 10:29:13 -0700 Subject: [PATCH] Validators now run a full gossip node while looking for a snapshot (#8872) automerge --- core/src/cluster_info.rs | 2 +- validator/src/main.rs | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index 79fe76e21a..d29e7d4d4c 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -1615,7 +1615,7 @@ impl ClusterInfo { .unwrap() } - fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr) -> ContactInfo { + pub fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr) -> ContactInfo { ContactInfo { id: *id, gossip, diff --git a/validator/src/main.rs b/validator/src/main.rs index 23353dc3f5..779936faaa 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -240,13 +240,14 @@ fn get_trusted_snapshot_hashes( } } -fn start_gossip_spy( +fn start_gossip_node( identity_keypair: &Arc, entrypoint_gossip: &SocketAddr, + gossip_addr: &SocketAddr, gossip_socket: UdpSocket, ) -> (Arc>, Arc, GossipService) { let mut cluster_info = ClusterInfo::new( - ClusterInfo::spy_contact_info(&identity_keypair.pubkey()), + ClusterInfo::gossip_contact_info(&identity_keypair.pubkey(), *gossip_addr), identity_keypair.clone(), ); cluster_info.set_entrypoint(ContactInfo::new_gossip_entry_point(entrypoint_gossip)); @@ -1047,13 +1048,19 @@ pub fn main() { }); let gossip_host = if let Some(entrypoint_addr) = entrypoint_addr { - solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| { - eprintln!( - "Failed to contact cluster entrypoint {}: {}", - entrypoint_addr, err - ); - exit(1); - }) + let ip_addr = + solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| { + eprintln!( + "Failed to contact cluster entrypoint {}: {}", + entrypoint_addr, err + ); + exit(1); + }); + info!( + "{} reports the IP address for this machine as {}", + entrypoint_addr, ip_addr + ); + ip_addr } else { solana_net_utils::parse_host(matches.value_of("gossip_host").unwrap_or("127.0.0.1")) .unwrap_or_else(|err| { @@ -1123,9 +1130,10 @@ pub fn main() { ); if !no_genesis_fetch { - let (cluster_info, gossip_exit_flag, gossip_service) = start_gossip_spy( + let (cluster_info, gossip_exit_flag, gossip_service) = start_gossip_node( &identity_keypair, &cluster_entrypoint.gossip, + &node.info.gossip, node.sockets.gossip.try_clone().unwrap(), );