From 972d101f6efacfe7f96c4b5f69d7f793719400ad Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 01:13:31 +0000 Subject: [PATCH] Default --rpc-bind-address to 127.0.0.1 when --private-rpc is provided and --bind-address is not (#20427) (cherry picked from commit 221343e849dfb2fafcabf3b896c3979e0ed15cea) Co-authored-by: Michael Vines --- validator/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index ae2768f695..0df47c5209 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -1524,7 +1524,7 @@ pub fn main() { .value_name("HOST") .takes_value(true) .validator(solana_net_utils::is_host) - .help("IP address to bind the RPC port [default: use --bind-address]"), + .help("IP address to bind the RPC port [default: 127.0.0.1 if --private-rpc is present, otherwise use --bind-address]"), ) .arg( Arg::with_name("rpc_threads") @@ -2084,6 +2084,8 @@ pub fn main() { let rpc_bind_address = if matches.is_present("rpc_bind_address") { solana_net_utils::parse_host(matches.value_of("rpc_bind_address").unwrap()) .expect("invalid rpc_bind_address") + } else if private_rpc { + solana_net_utils::parse_host("127.0.0.1").unwrap() } else { bind_address };