mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
## Issue Addressed Resolves #2004 ## Proposed Changes Only print validator dir path once ## Additional Info N/A Co-authored-by: realbigsean <seananderson33@gmail.com>
29 lines
744 B
Rust
29 lines
744 B
Rust
use account_utils::validator_definitions::ValidatorDefinitions;
|
|
use clap::App;
|
|
use std::path::PathBuf;
|
|
|
|
pub const CMD: &str = "list";
|
|
|
|
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|
App::new(CMD).about("Lists the public keys of all validators.")
|
|
}
|
|
|
|
pub fn cli_run(validator_dir: PathBuf) -> Result<(), String> {
|
|
let validator_definitions = ValidatorDefinitions::open(&validator_dir).map_err(|e| {
|
|
format!(
|
|
"No validator definitions found in {:?}: {:?}",
|
|
validator_dir, e
|
|
)
|
|
})?;
|
|
|
|
for def in validator_definitions.as_slice() {
|
|
println!(
|
|
"{} ({})",
|
|
def.voting_public_key,
|
|
if def.enabled { "enabled" } else { "disabled" }
|
|
);
|
|
}
|
|
|
|
Ok(())
|
|
}
|