Skip to content

Commit d9193e8

Browse files
committed
make test-validator bind to localhost by default
1 parent 7f48e52 commit d9193e8

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

validator/src/bin/solana-test-validator.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,16 @@ fn main() {
172172
exit(1);
173173
})
174174
});
175-
let bind_address = matches.value_of("bind_address").map(|bind_address| {
176-
solana_net_utils::parse_host(bind_address).unwrap_or_else(|err| {
177-
eprintln!("Failed to parse --bind-address: {err}");
178-
exit(1);
179-
})
175+
let bind_address = solana_net_utils::parse_host(
176+
matches
177+
.value_of("bind_address")
178+
.expect("Bind address has default value"),
179+
)
180+
.unwrap_or_else(|err| {
181+
eprintln!("Failed to parse --bind-address: {err}");
182+
exit(1);
180183
});
184+
181185
let compute_unit_limit = value_t!(matches, "compute_unit_limit", u64).ok();
182186

183187
let faucet_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), faucet_port);
@@ -552,9 +556,7 @@ fn main() {
552556
genesis.port_range(dynamic_port_range);
553557
}
554558

555-
if let Some(bind_address) = bind_address {
556-
genesis.bind_ip_addr(bind_address);
557-
}
559+
genesis.bind_ip_addr(bind_address);
558560

559561
if matches.is_present("geyser_plugin_config") {
560562
genesis.geyser_plugin_config_files = Some(

validator/src/cli.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ pub fn test_app<'a>(version: &'a str, default_args: &'a DefaultTestArgs) -> App<
863863
.value_name("HOST")
864864
.takes_value(true)
865865
.validator(solana_net_utils::is_host)
866-
.default_value("0.0.0.0")
867-
.help("IP address to bind the validator ports [default: 0.0.0.0]"),
866+
.default_value("127.0.0.1")
867+
.help("IP address to bind the validator ports [default: 127.0.0.1]"),
868868
)
869869
.arg(
870870
Arg::with_name("clone_account")

0 commit comments

Comments
 (0)