Remove many uses of legacy term 'fullnode' (#6324)

This commit is contained in:
Greg Fitzgerald
2019-10-10 17:33:00 -06:00
committed by GitHub
parent 9cde67086f
commit c6e4641781
25 changed files with 93 additions and 94 deletions

View File

@ -52,7 +52,7 @@ use std::sync::{Arc, RwLock};
use std::thread::{sleep, Builder, JoinHandle};
use std::time::{Duration, Instant};
pub const FULLNODE_PORT_RANGE: PortRange = (8000, 10_000);
pub const VALIDATOR_PORT_RANGE: PortRange = (8000, 10_000);
/// The Data plane fanout size, also used as the neighborhood size
pub const DATA_PLANE_FANOUT: usize = 200;
@ -1483,7 +1483,7 @@ impl ClusterInfo {
/// An alternative to Spy Node that has a valid gossip address and fully participate in Gossip.
pub fn gossip_node(id: &Pubkey, gossip_addr: &SocketAddr) -> (ContactInfo, UdpSocket) {
let (port, (gossip_socket, _)) = Node::get_gossip_port(gossip_addr, FULLNODE_PORT_RANGE);
let (port, (gossip_socket, _)) = Node::get_gossip_port(gossip_addr, VALIDATOR_PORT_RANGE);
let daddr = socketaddr_any!();
let node = ContactInfo::new(
@ -1503,7 +1503,7 @@ impl ClusterInfo {
/// A Node with invalid ports to spy on gossip via pull requests
pub fn spy_node(id: &Pubkey) -> (ContactInfo, UdpSocket) {
let (_, gossip_socket) = bind_in_range(FULLNODE_PORT_RANGE).unwrap();
let (_, gossip_socket) = bind_in_range(VALIDATOR_PORT_RANGE).unwrap();
let daddr = socketaddr_any!();
let node = ContactInfo::new(
@ -2089,27 +2089,27 @@ mod tests {
let node = Node::new_with_external_ip(
&Pubkey::new_rand(),
&socketaddr!(ip, 0),
FULLNODE_PORT_RANGE,
VALIDATOR_PORT_RANGE,
);
check_node_sockets(&node, IpAddr::V4(ip), FULLNODE_PORT_RANGE);
check_node_sockets(&node, IpAddr::V4(ip), VALIDATOR_PORT_RANGE);
}
#[test]
fn new_with_external_ip_test_gossip() {
let ip = IpAddr::V4(Ipv4Addr::from(0));
let port = {
bind_in_range(FULLNODE_PORT_RANGE)
bind_in_range(VALIDATOR_PORT_RANGE)
.expect("Failed to bind")
.0
};
let node = Node::new_with_external_ip(
&Pubkey::new_rand(),
&socketaddr!(0, port),
FULLNODE_PORT_RANGE,
VALIDATOR_PORT_RANGE,
);
check_node_sockets(&node, ip, FULLNODE_PORT_RANGE);
check_node_sockets(&node, ip, VALIDATOR_PORT_RANGE);
assert_eq!(node.sockets.gossip.local_addr().unwrap().port(), port);
}
@ -2120,15 +2120,15 @@ mod tests {
let node = Node::new_replicator_with_external_ip(
&Pubkey::new_rand(),
&socketaddr!(ip, 0),
FULLNODE_PORT_RANGE,
VALIDATOR_PORT_RANGE,
);
let ip = IpAddr::V4(ip);
check_socket(&node.sockets.storage.unwrap(), ip, FULLNODE_PORT_RANGE);
check_socket(&node.sockets.gossip, ip, FULLNODE_PORT_RANGE);
check_socket(&node.sockets.repair, ip, FULLNODE_PORT_RANGE);
check_socket(&node.sockets.storage.unwrap(), ip, VALIDATOR_PORT_RANGE);
check_socket(&node.sockets.gossip, ip, VALIDATOR_PORT_RANGE);
check_socket(&node.sockets.repair, ip, VALIDATOR_PORT_RANGE);
check_sockets(&node.sockets.tvu, ip, FULLNODE_PORT_RANGE);
check_sockets(&node.sockets.tvu, ip, VALIDATOR_PORT_RANGE);
}
//test that all cluster_info objects only generate signed messages

View File

@ -2,7 +2,7 @@
use crate::bank_forks::BankForks;
use crate::blocktree::Blocktree;
use crate::cluster_info::{ClusterInfo, FULLNODE_PORT_RANGE};
use crate::cluster_info::{ClusterInfo, VALIDATOR_PORT_RANGE};
use crate::contact_info::ContactInfo;
use crate::service::Service;
use crate::streamer;
@ -119,7 +119,7 @@ pub fn get_clients(nodes: &[ContactInfo]) -> Vec<ThinClient> {
nodes
.iter()
.filter_map(ContactInfo::valid_client_facing_addr)
.map(|addrs| create_client(addrs, FULLNODE_PORT_RANGE))
.map(|addrs| create_client(addrs, VALIDATOR_PORT_RANGE))
.collect()
}
@ -130,7 +130,7 @@ pub fn get_client(nodes: &[ContactInfo]) -> ThinClient {
.filter_map(ContactInfo::valid_client_facing_addr)
.collect();
let select = thread_rng().gen_range(0, nodes.len());
create_client(nodes[select], FULLNODE_PORT_RANGE)
create_client(nodes[select], VALIDATOR_PORT_RANGE)
}
pub fn get_multi_client(nodes: &[ContactInfo]) -> (ThinClient, usize) {
@ -141,7 +141,7 @@ pub fn get_multi_client(nodes: &[ContactInfo]) -> (ThinClient, usize) {
.collect();
let rpc_addrs: Vec<_> = addrs.iter().map(|addr| addr.0).collect();
let tpu_addrs: Vec<_> = addrs.iter().map(|addr| addr.1).collect();
let (_, transactions_socket) = solana_netutil::bind_in_range(FULLNODE_PORT_RANGE).unwrap();
let (_, transactions_socket) = solana_netutil::bind_in_range(VALIDATOR_PORT_RANGE).unwrap();
let num_nodes = tpu_addrs.len();
(
ThinClient::new_from_addrs(rpc_addrs, tpu_addrs, transactions_socket),

View File

@ -1,6 +1,6 @@
use crate::blocktree::Blocktree;
use crate::chacha::{chacha_cbc_encrypt_ledger, CHACHA_BLOCK_SIZE};
use crate::cluster_info::{ClusterInfo, Node, FULLNODE_PORT_RANGE};
use crate::cluster_info::{ClusterInfo, Node, VALIDATOR_PORT_RANGE};
use crate::contact_info::ContactInfo;
use crate::gossip_service::GossipService;
use crate::leader_schedule_cache::LeaderScheduleCache;
@ -805,7 +805,7 @@ impl Replicator {
let exit = Arc::new(AtomicBool::new(false));
let (s_reader, r_reader) = channel();
let repair_socket = Arc::new(bind_in_range(FULLNODE_PORT_RANGE).unwrap().1);
let repair_socket = Arc::new(bind_in_range(VALIDATOR_PORT_RANGE).unwrap().1);
let t_receiver = receiver(
repair_socket.clone(),
&exit,
@ -907,7 +907,7 @@ impl Replicator {
}
fn get_replicator_segment_slot(to: SocketAddr) -> u64 {
let (_port, socket) = bind_in_range(FULLNODE_PORT_RANGE).unwrap();
let (_port, socket) = bind_in_range(VALIDATOR_PORT_RANGE).unwrap();
socket
.set_read_timeout(Some(Duration::from_secs(5)))
.unwrap();