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 =

View File

@ -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") {
(

View File

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

View File

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