add plumbing to allow for arbitrary tpu address in gossip (#22703)
* add plumbing to allow for arbitrary tpu address in gossip * make clippy happy * Review comments Co-authored-by: CherryWorm <nico.gruendel@web.de>
This commit is contained in:
parent
d3ebe8d8f5
commit
a4f4ac5279
|
@ -2899,6 +2899,7 @@ impl Node {
|
||||||
gossip_addr: &SocketAddr,
|
gossip_addr: &SocketAddr,
|
||||||
port_range: PortRange,
|
port_range: PortRange,
|
||||||
bind_ip_addr: IpAddr,
|
bind_ip_addr: IpAddr,
|
||||||
|
overwrite_tpu_addr: Option<SocketAddr>,
|
||||||
) -> Node {
|
) -> Node {
|
||||||
let (gossip_port, (gossip, ip_echo)) =
|
let (gossip_port, (gossip, ip_echo)) =
|
||||||
Self::get_gossip_port(gossip_addr, port_range, bind_ip_addr);
|
Self::get_gossip_port(gossip_addr, port_range, bind_ip_addr);
|
||||||
|
@ -2940,7 +2941,7 @@ impl Node {
|
||||||
tvu: SocketAddr::new(gossip_addr.ip(), tvu_port),
|
tvu: SocketAddr::new(gossip_addr.ip(), tvu_port),
|
||||||
tvu_forwards: SocketAddr::new(gossip_addr.ip(), tvu_forwards_port),
|
tvu_forwards: SocketAddr::new(gossip_addr.ip(), tvu_forwards_port),
|
||||||
repair: SocketAddr::new(gossip_addr.ip(), repair_port),
|
repair: SocketAddr::new(gossip_addr.ip(), repair_port),
|
||||||
tpu: SocketAddr::new(gossip_addr.ip(), tpu_port),
|
tpu: overwrite_tpu_addr.unwrap_or_else(|| SocketAddr::new(gossip_addr.ip(), tpu_port)),
|
||||||
tpu_forwards: SocketAddr::new(gossip_addr.ip(), tpu_forwards_port),
|
tpu_forwards: SocketAddr::new(gossip_addr.ip(), tpu_forwards_port),
|
||||||
tpu_vote: SocketAddr::new(gossip_addr.ip(), tpu_vote_port),
|
tpu_vote: SocketAddr::new(gossip_addr.ip(), tpu_vote_port),
|
||||||
rpc: socketaddr_any!(),
|
rpc: socketaddr_any!(),
|
||||||
|
@ -3500,6 +3501,7 @@ mod tests {
|
||||||
&socketaddr!(ip, 0),
|
&socketaddr!(ip, 0),
|
||||||
VALIDATOR_PORT_RANGE,
|
VALIDATOR_PORT_RANGE,
|
||||||
IpAddr::V4(ip),
|
IpAddr::V4(ip),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
check_node_sockets(&node, IpAddr::V4(ip), VALIDATOR_PORT_RANGE);
|
check_node_sockets(&node, IpAddr::V4(ip), VALIDATOR_PORT_RANGE);
|
||||||
|
@ -3521,6 +3523,7 @@ mod tests {
|
||||||
&socketaddr!(0, port),
|
&socketaddr!(0, port),
|
||||||
port_range,
|
port_range,
|
||||||
ip,
|
ip,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
check_node_sockets(&node, ip, port_range);
|
check_node_sockets(&node, ip, port_range);
|
||||||
|
|
|
@ -291,6 +291,7 @@ pub fn main() {
|
||||||
&gossip_addr,
|
&gossip_addr,
|
||||||
dynamic_port_range,
|
dynamic_port_range,
|
||||||
bind_address,
|
bind_address,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
||||||
|
|
|
@ -252,6 +252,7 @@ fn test_replica_bootstrap() {
|
||||||
&gossip_addr,
|
&gossip_addr,
|
||||||
dynamic_port_range,
|
dynamic_port_range,
|
||||||
bind_address,
|
bind_address,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
info!("The peer id: {:?}", &contact_info.id);
|
info!("The peer id: {:?}", &contact_info.id);
|
||||||
|
|
|
@ -775,6 +775,16 @@ pub fn main() {
|
||||||
.help("Gossip DNS name or IP address for the validator to advertise in gossip \
|
.help("Gossip DNS name or IP address for the validator to advertise in gossip \
|
||||||
[default: ask --entrypoint, or 127.0.0.1 when --entrypoint is not provided]"),
|
[default: ask --entrypoint, or 127.0.0.1 when --entrypoint is not provided]"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("tpu_host_addr")
|
||||||
|
.long("tpu-host-addr")
|
||||||
|
.value_name("HOST:PORT")
|
||||||
|
.takes_value(true)
|
||||||
|
.validator(solana_net_utils::is_host_port)
|
||||||
|
.help("Specify TPU address to advertise in gossip [default: ask --entrypoint or localhost\
|
||||||
|
when --entrypoint is not provided]"),
|
||||||
|
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("public_rpc_addr")
|
Arg::with_name("public_rpc_addr")
|
||||||
.long("public-rpc-address")
|
.long("public-rpc-address")
|
||||||
|
@ -2602,6 +2612,13 @@ pub fn main() {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let overwrite_tpu_addr = matches.value_of("tpu_host_addr").map(|tpu_addr| {
|
||||||
|
solana_net_utils::parse_host_port(tpu_addr).unwrap_or_else(|err| {
|
||||||
|
eprintln!("Failed to parse --overwrite-tpu-addr: {}", err);
|
||||||
|
exit(1);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
let cluster_entrypoints = entrypoint_addrs
|
let cluster_entrypoints = entrypoint_addrs
|
||||||
.iter()
|
.iter()
|
||||||
.map(ContactInfo::new_gossip_entry_point)
|
.map(ContactInfo::new_gossip_entry_point)
|
||||||
|
@ -2612,6 +2629,7 @@ pub fn main() {
|
||||||
&gossip_addr,
|
&gossip_addr,
|
||||||
dynamic_port_range,
|
dynamic_port_range,
|
||||||
bind_address,
|
bind_address,
|
||||||
|
overwrite_tpu_addr,
|
||||||
);
|
);
|
||||||
|
|
||||||
if restricted_repair_only_mode {
|
if restricted_repair_only_mode {
|
||||||
|
|
Loading…
Reference in New Issue