diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index 7df052e1d..31fb3f8b9 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -1616,7 +1616,7 @@ mod tests { solana_logger::setup(); let node_info = NodeInfo::new_localhost(Keypair::new().pubkey(), 0); let mut cluster_info = ClusterInfo::new_with_invalid_keypair(node_info); - let network_entry_point = NodeInfo::new_entry_point(&socketaddr!("127.0.0.1:1239")); + let network_entry_point = NodeInfo::new_gossip_entry_point(&socketaddr!("127.0.0.1:1239")); cluster_info.insert_info(network_entry_point); assert!(cluster_info.leader_data().is_none()); } diff --git a/core/src/contact_info.rs b/core/src/contact_info.rs index 6d62451b1..ca32bf4ba 100644 --- a/core/src/contact_info.rs +++ b/core/src/contact_info.rs @@ -92,7 +92,7 @@ impl ContactInfo { rpc_pubsub: SocketAddr, now: u64, ) -> Self { - ContactInfo { + Self { id, signature: Signature::default(), gossip, @@ -145,7 +145,7 @@ impl ContactInfo { let tvu_addr = Self::next_port(&bind_addr, 2); let rpc_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT); let rpc_pubsub_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT + 1); - ContactInfo::new( + Self::new( pubkey, gossip_addr, tvu_addr, @@ -160,10 +160,11 @@ impl ContactInfo { let keypair = Keypair::new(); Self::new_with_pubkey_socketaddr(keypair.pubkey(), bind_addr) } - // - pub fn new_entry_point(gossip_addr: &SocketAddr) -> Self { + + // Construct a ContactInfo that's only usable for gossip + pub fn new_gossip_entry_point(gossip_addr: &SocketAddr) -> Self { let daddr: SocketAddr = socketaddr!("0.0.0.0:0"); - ContactInfo::new( + Self::new( Pubkey::default(), *gossip_addr, daddr, @@ -268,7 +269,7 @@ mod tests { #[test] fn test_entry_point() { let addr = socketaddr!("127.0.0.1:10"); - let ci = ContactInfo::new_entry_point(&addr); + let ci = ContactInfo::new_gossip_entry_point(&addr); assert_eq!(ci.gossip, addr); assert!(ci.tvu.ip().is_unspecified()); assert!(ci.rpc.ip().is_unspecified()); diff --git a/core/src/gossip_service.rs b/core/src/gossip_service.rs index b31b18cfb..12bcea878 100644 --- a/core/src/gossip_service.rs +++ b/core/src/gossip_service.rs @@ -108,7 +108,7 @@ fn make_spy_node( let keypair = Arc::new(Keypair::new()); let (node, gossip_socket) = ClusterInfo::spy_node(&keypair.pubkey()); let mut cluster_info = ClusterInfo::new(node, keypair); - cluster_info.insert_info(ContactInfo::new_entry_point(gossip_addr)); + cluster_info.insert_info(ContactInfo::new_gossip_entry_point(gossip_addr)); let cluster_info = Arc::new(RwLock::new(cluster_info)); let gossip_service = diff --git a/fullnode/src/main.rs b/fullnode/src/main.rs index 7477b683b..cd99c413f 100644 --- a/fullnode/src/main.rs +++ b/fullnode/src/main.rs @@ -183,7 +183,7 @@ fn main() { } let cluster_entrypoint = matches.value_of("network").map(|network| { let gossip_addr = network.parse().expect("failed to parse network address"); - NodeInfo::new_entry_point(&gossip_addr) + NodeInfo::new_gossip_entry_point(&gossip_addr) }); let (_signer_service, _signer_addr) = if let Some(signer_addr) = matches.value_of("signer") { ( diff --git a/replicator/src/main.rs b/replicator/src/main.rs index 6ab7a918e..4019e3f6d 100644 --- a/replicator/src/main.rs +++ b/replicator/src/main.rs @@ -79,7 +79,7 @@ fn main() { .map(|network| network.parse().expect("failed to parse network address")) .unwrap(); - let leader_info = NodeInfo::new_entry_point(&network_addr); + let leader_info = NodeInfo::new_gossip_entry_point(&network_addr); let replicator = Replicator::new(ledger_path, node, &leader_info, &Arc::new(keypair), None).unwrap(); diff --git a/tests/replicator.rs b/tests/replicator.rs index 11376e1bc..450f527cb 100644 --- a/tests/replicator.rs +++ b/tests/replicator.rs @@ -128,7 +128,7 @@ fn test_replicator_startup_basic() { let replicator_node = Node::new_localhost_with_pubkey(replicator_keypair.pubkey()); let replicator_info = replicator_node.info.clone(); - let leader_info = NodeInfo::new_entry_point(&leader_info.gossip); + let leader_info = NodeInfo::new_gossip_entry_point(&leader_info.gossip); let replicator = Replicator::new( replicator_ledger_path, @@ -242,7 +242,7 @@ fn test_replicator_startup_leader_hang() { let replicator_node = Node::new_localhost_with_pubkey(replicator_keypair.pubkey()); let fake_gossip = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0); - let leader_info = NodeInfo::new_entry_point(&fake_gossip); + let leader_info = NodeInfo::new_gossip_entry_point(&fake_gossip); let replicator_res = Replicator::new( &replicator_ledger_path, @@ -312,7 +312,7 @@ fn test_replicator_startup_ledger_hang() { // Pass bad TVU sockets to prevent successful ledger download replicator_node.sockets.tvu = vec![std::net::UdpSocket::bind("0.0.0.0:0").unwrap()]; - let leader_info = NodeInfo::new_entry_point(&leader_info.gossip); + let leader_info = NodeInfo::new_gossip_entry_point(&leader_info.gossip); let replicator_res = Replicator::new( &replicator_ledger_path,