Rename new_entry_point as new_gossip_entry_point to clarify usage

This commit is contained in:
Michael Vines
2019-03-08 17:15:08 -08:00
parent cd88f81817
commit 31cbb52654
6 changed files with 14 additions and 13 deletions

View File

@ -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());
}

View File

@ -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());

View File

@ -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 =