diff --git a/lighthouse/tests/validator_client.rs b/lighthouse/tests/validator_client.rs index 3e85375971..1fc5d22698 100644 --- a/lighthouse/tests/validator_client.rs +++ b/lighthouse/tests/validator_client.rs @@ -2,6 +2,7 @@ use validator_client::{config::DEFAULT_WEB3SIGNER_KEEP_ALIVE, ApiTopic, Config}; use crate::exec::CommandLineTestExec; use bls::{Keypair, PublicKeyBytes}; +use sensitive_url::SensitiveUrl; use std::fs::File; use std::io::Write; use std::net::IpAddr; @@ -672,3 +673,26 @@ fn validator_web3_signer_keep_alive_override() { ); }); } + +#[test] +fn validator_proposer_nodes_default_empty() { + CommandLineTest::new().run().with_config(|config| { + assert_eq!(config.proposer_nodes, vec![]); + }); +} + +#[test] +fn validator_proposer_nodes() { + CommandLineTest::new() + .flag("proposer-nodes", Some("http://bn-1:5052,http://bn-2:5052")) + .run() + .with_config(|config| { + assert_eq!( + config.proposer_nodes, + vec![ + SensitiveUrl::parse("http://bn-1:5052").unwrap(), + SensitiveUrl::parse("http://bn-2:5052").unwrap() + ] + ); + }); +} diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index 3edab712b3..7378d924b7 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -187,7 +187,7 @@ impl Config { .collect::>() .map_err(|e| format!("Unable to parse beacon node URL: {:?}", e))?; } - if let Some(proposer_nodes) = parse_optional::(cli_args, "proposer_nodes")? { + if let Some(proposer_nodes) = parse_optional::(cli_args, "proposer-nodes")? { config.proposer_nodes = proposer_nodes .split(',') .map(SensitiveUrl::parse)