Rename new_entry_point as new_gossip_entry_point to clarify usage
This commit is contained in:
parent
cd88f81817
commit
31cbb52654
|
@ -1616,7 +1616,7 @@ mod tests {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let node_info = NodeInfo::new_localhost(Keypair::new().pubkey(), 0);
|
let node_info = NodeInfo::new_localhost(Keypair::new().pubkey(), 0);
|
||||||
let mut cluster_info = ClusterInfo::new_with_invalid_keypair(node_info);
|
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);
|
cluster_info.insert_info(network_entry_point);
|
||||||
assert!(cluster_info.leader_data().is_none());
|
assert!(cluster_info.leader_data().is_none());
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl ContactInfo {
|
||||||
rpc_pubsub: SocketAddr,
|
rpc_pubsub: SocketAddr,
|
||||||
now: u64,
|
now: u64,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
ContactInfo {
|
Self {
|
||||||
id,
|
id,
|
||||||
signature: Signature::default(),
|
signature: Signature::default(),
|
||||||
gossip,
|
gossip,
|
||||||
|
@ -145,7 +145,7 @@ impl ContactInfo {
|
||||||
let tvu_addr = Self::next_port(&bind_addr, 2);
|
let tvu_addr = Self::next_port(&bind_addr, 2);
|
||||||
let rpc_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT);
|
let rpc_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT);
|
||||||
let rpc_pubsub_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT + 1);
|
let rpc_pubsub_addr = SocketAddr::new(bind_addr.ip(), RPC_PORT + 1);
|
||||||
ContactInfo::new(
|
Self::new(
|
||||||
pubkey,
|
pubkey,
|
||||||
gossip_addr,
|
gossip_addr,
|
||||||
tvu_addr,
|
tvu_addr,
|
||||||
|
@ -160,10 +160,11 @@ impl ContactInfo {
|
||||||
let keypair = Keypair::new();
|
let keypair = Keypair::new();
|
||||||
Self::new_with_pubkey_socketaddr(keypair.pubkey(), bind_addr)
|
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");
|
let daddr: SocketAddr = socketaddr!("0.0.0.0:0");
|
||||||
ContactInfo::new(
|
Self::new(
|
||||||
Pubkey::default(),
|
Pubkey::default(),
|
||||||
*gossip_addr,
|
*gossip_addr,
|
||||||
daddr,
|
daddr,
|
||||||
|
@ -268,7 +269,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_entry_point() {
|
fn test_entry_point() {
|
||||||
let addr = socketaddr!("127.0.0.1:10");
|
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_eq!(ci.gossip, addr);
|
||||||
assert!(ci.tvu.ip().is_unspecified());
|
assert!(ci.tvu.ip().is_unspecified());
|
||||||
assert!(ci.rpc.ip().is_unspecified());
|
assert!(ci.rpc.ip().is_unspecified());
|
||||||
|
|
|
@ -108,7 +108,7 @@ fn make_spy_node(
|
||||||
let keypair = Arc::new(Keypair::new());
|
let keypair = Arc::new(Keypair::new());
|
||||||
let (node, gossip_socket) = ClusterInfo::spy_node(&keypair.pubkey());
|
let (node, gossip_socket) = ClusterInfo::spy_node(&keypair.pubkey());
|
||||||
let mut cluster_info = ClusterInfo::new(node, keypair);
|
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 cluster_info = Arc::new(RwLock::new(cluster_info));
|
||||||
let gossip_service =
|
let gossip_service =
|
||||||
|
|
|
@ -183,7 +183,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
let cluster_entrypoint = matches.value_of("network").map(|network| {
|
let cluster_entrypoint = matches.value_of("network").map(|network| {
|
||||||
let gossip_addr = network.parse().expect("failed to parse network address");
|
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") {
|
let (_signer_service, _signer_addr) = if let Some(signer_addr) = matches.value_of("signer") {
|
||||||
(
|
(
|
||||||
|
|
|
@ -79,7 +79,7 @@ fn main() {
|
||||||
.map(|network| network.parse().expect("failed to parse network address"))
|
.map(|network| network.parse().expect("failed to parse network address"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let leader_info = NodeInfo::new_entry_point(&network_addr);
|
let leader_info = NodeInfo::new_gossip_entry_point(&network_addr);
|
||||||
|
|
||||||
let replicator =
|
let replicator =
|
||||||
Replicator::new(ledger_path, node, &leader_info, &Arc::new(keypair), None).unwrap();
|
Replicator::new(ledger_path, node, &leader_info, &Arc::new(keypair), None).unwrap();
|
||||||
|
|
|
@ -128,7 +128,7 @@ fn test_replicator_startup_basic() {
|
||||||
let replicator_node = Node::new_localhost_with_pubkey(replicator_keypair.pubkey());
|
let replicator_node = Node::new_localhost_with_pubkey(replicator_keypair.pubkey());
|
||||||
let replicator_info = replicator_node.info.clone();
|
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(
|
let replicator = Replicator::new(
|
||||||
replicator_ledger_path,
|
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 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 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(
|
let replicator_res = Replicator::new(
|
||||||
&replicator_ledger_path,
|
&replicator_ledger_path,
|
||||||
|
@ -312,7 +312,7 @@ fn test_replicator_startup_ledger_hang() {
|
||||||
// Pass bad TVU sockets to prevent successful ledger download
|
// Pass bad TVU sockets to prevent successful ledger download
|
||||||
replicator_node.sockets.tvu = vec![std::net::UdpSocket::bind("0.0.0.0:0").unwrap()];
|
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(
|
let replicator_res = Replicator::new(
|
||||||
&replicator_ledger_path,
|
&replicator_ledger_path,
|
||||||
|
|
Loading…
Reference in New Issue