Validators now run a full gossip node while looking for a snapshot
This commit is contained in:
parent
dd5e320aa1
commit
5481d1a039
|
@ -1601,7 +1601,7 @@ impl ClusterInfo {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr) -> ContactInfo {
|
pub fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr) -> ContactInfo {
|
||||||
ContactInfo {
|
ContactInfo {
|
||||||
id: *id,
|
id: *id,
|
||||||
gossip,
|
gossip,
|
||||||
|
|
|
@ -120,13 +120,14 @@ fn get_trusted_snapshot_hashes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_gossip_spy(
|
fn start_gossip_node(
|
||||||
identity_keypair: &Arc<Keypair>,
|
identity_keypair: &Arc<Keypair>,
|
||||||
entrypoint_gossip: &SocketAddr,
|
entrypoint_gossip: &SocketAddr,
|
||||||
|
gossip_addr: &SocketAddr,
|
||||||
gossip_socket: UdpSocket,
|
gossip_socket: UdpSocket,
|
||||||
) -> (Arc<RwLock<ClusterInfo>>, Arc<AtomicBool>, GossipService) {
|
) -> (Arc<RwLock<ClusterInfo>>, Arc<AtomicBool>, GossipService) {
|
||||||
let mut cluster_info = ClusterInfo::new(
|
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(),
|
identity_keypair.clone(),
|
||||||
);
|
);
|
||||||
cluster_info.set_entrypoint(ContactInfo::new_gossip_entry_point(entrypoint_gossip));
|
cluster_info.set_entrypoint(ContactInfo::new_gossip_entry_point(entrypoint_gossip));
|
||||||
|
@ -859,13 +860,19 @@ pub fn main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
let gossip_host = if let Some(entrypoint_addr) = entrypoint_addr {
|
let gossip_host = if let Some(entrypoint_addr) = entrypoint_addr {
|
||||||
solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
|
let ip_addr =
|
||||||
eprintln!(
|
solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
|
||||||
"Failed to contact cluster entrypoint {}: {}",
|
eprintln!(
|
||||||
entrypoint_addr, err
|
"Failed to contact cluster entrypoint {}: {}",
|
||||||
);
|
entrypoint_addr, err
|
||||||
exit(1);
|
);
|
||||||
})
|
exit(1);
|
||||||
|
});
|
||||||
|
info!(
|
||||||
|
"{} reports the IP address for this machine as {}",
|
||||||
|
entrypoint_addr, ip_addr
|
||||||
|
);
|
||||||
|
ip_addr
|
||||||
} else {
|
} else {
|
||||||
solana_net_utils::parse_host(matches.value_of("gossip_host").unwrap_or("127.0.0.1"))
|
solana_net_utils::parse_host(matches.value_of("gossip_host").unwrap_or("127.0.0.1"))
|
||||||
.unwrap_or_else(|err| {
|
.unwrap_or_else(|err| {
|
||||||
|
@ -935,9 +942,10 @@ pub fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
if !no_genesis_fetch {
|
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,
|
&identity_keypair,
|
||||||
&cluster_entrypoint.gossip,
|
&cluster_entrypoint.gossip,
|
||||||
|
&node.info.gossip,
|
||||||
node.sockets.gossip.try_clone().unwrap(),
|
node.sockets.gossip.try_clone().unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue