Add get-rpc-url --any option
This commit is contained in:
parent
965b132664
commit
48a36f59a6
|
@ -38,6 +38,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
.takes_value(false)
|
||||
.help("Return all RPC URLs"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("any")
|
||||
.long("any")
|
||||
.takes_value(false)
|
||||
.conflicts_with("all")
|
||||
.help("Return any RPC URL"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("timeout")
|
||||
.long("timeout")
|
||||
|
@ -237,6 +244,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
}
|
||||
}
|
||||
("get-rpc-url", Some(matches)) => {
|
||||
let any = matches.is_present("any");
|
||||
let all = matches.is_present("all");
|
||||
let entrypoint_addr = parse_entrypoint(&matches);
|
||||
let timeout = value_t_or_exit!(matches, "timeout", u64);
|
||||
let (nodes, _archivers) = discover(
|
||||
|
@ -251,7 +260,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
let rpc_addrs: Vec<_> = nodes
|
||||
.iter()
|
||||
.filter_map(|contact_info| {
|
||||
if (matches.is_present("all") || Some(contact_info.gossip) == entrypoint_addr)
|
||||
if (any || all || Some(contact_info.gossip) == entrypoint_addr)
|
||||
&& ContactInfo::is_valid_address(&contact_info.rpc)
|
||||
{
|
||||
return Some(contact_info.rpc);
|
||||
|
@ -267,6 +276,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
|
||||
for rpc_addr in rpc_addrs {
|
||||
println!("http://{}", rpc_addr);
|
||||
if any {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
("stop", Some(matches)) => {
|
||||
|
|
|
@ -273,7 +273,7 @@ setup_validator_accounts() {
|
|||
return 0
|
||||
}
|
||||
|
||||
rpc_url=$($solana_gossip get-rpc-url --entrypoint "$gossip_entrypoint")
|
||||
rpc_url=$($solana_gossip get-rpc-url --entrypoint "$gossip_entrypoint" --any)
|
||||
|
||||
[[ -r "$identity_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$identity_keypair_path"
|
||||
[[ -r "$voting_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$voting_keypair_path"
|
||||
|
|
Loading…
Reference in New Issue