From 307686eeba34d62ca4b9490b2f8f93d2e35d2c6e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:46:40 +0000 Subject: [PATCH] Add --no-port-check to validator (#12245) (#12638) (cherry picked from commit aa70dbfc620459f730065753ec77c3f9cfe5cd40) Co-authored-by: Ryo Onodera --- validator/src/main.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index 22ba10e9cd..67e8a95a38 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -605,8 +605,11 @@ fn rpc_bootstrap( cluster_entrypoint: &ContactInfo, validator_config: &mut ValidatorConfig, bootstrap_config: RpcBootstrapConfig, + no_port_check: bool, ) { - verify_reachable_ports(&node, cluster_entrypoint, &validator_config); + if !no_port_check { + verify_reachable_ports(&node, cluster_entrypoint, &validator_config); + } if bootstrap_config.no_genesis_fetch && bootstrap_config.no_snapshot_fetch { return; @@ -752,6 +755,7 @@ fn create_validator( cluster_entrypoint: Option, mut validator_config: ValidatorConfig, rpc_bootstrap_config: RpcBootstrapConfig, + no_port_check: bool, ) -> Validator { if validator_config.cuda { solana_perf::perf_libs::init_cuda(); @@ -769,6 +773,7 @@ fn create_validator( cluster_entrypoint, &mut validator_config, rpc_bootstrap_config, + no_port_check, ); } @@ -921,6 +926,12 @@ pub fn main() { .takes_value(false) .help("Do not publish the RPC port for use by other nodes") ) + .arg( + Arg::with_name("no_port_check") + .long("--no-port-check") + .takes_value(false) + .help("Do not perform TCP/UDP reachable port checks at start-up") + ) .arg( Arg::with_name("enable_rpc_exit") .long("enable-rpc-exit") @@ -1307,6 +1318,7 @@ pub fn main() { }; let private_rpc = matches.is_present("private_rpc"); + let no_port_check = matches.is_present("no_port_check"); let no_rocksdb_compaction = matches.is_present("no_rocksdb_compaction"); let wal_recovery_mode = matches .value_of("wal_recovery_mode") @@ -1390,6 +1402,8 @@ pub fn main() { ( SocketAddr::new(rpc_bind_address, rpc_port), SocketAddr::new(rpc_bind_address, rpc_port + 1), + // +2 is skipped to avoid a conflict with the websocket port (which is +2) in web3.js + // This odd port shifting is tracked at https://github.com/solana-labs/solana/issues/12250 SocketAddr::new(rpc_bind_address, rpc_port + 3), ) }), @@ -1640,6 +1654,7 @@ pub fn main() { cluster_entrypoint, validator_config, rpc_bootstrap_config, + no_port_check, ); if let Some(filename) = init_complete_file {