mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Link validator_manager into Lighthouse binary
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -3648,6 +3648,7 @@ dependencies = [
|
|||||||
"unused_port",
|
"unused_port",
|
||||||
"validator_client",
|
"validator_client",
|
||||||
"validator_dir",
|
"validator_dir",
|
||||||
|
"validator_manager",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ directory = { path = "../common/directory" }
|
|||||||
unused_port = { path = "../common/unused_port" }
|
unused_port = { path = "../common/unused_port" }
|
||||||
database_manager = { path = "../database_manager" }
|
database_manager = { path = "../database_manager" }
|
||||||
slasher = { path = "../slasher" }
|
slasher = { path = "../slasher" }
|
||||||
|
validator_manager = { path = "../validator_manager" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ fn main() {
|
|||||||
.subcommand(validator_client::cli_app())
|
.subcommand(validator_client::cli_app())
|
||||||
.subcommand(account_manager::cli_app())
|
.subcommand(account_manager::cli_app())
|
||||||
.subcommand(database_manager::cli_app())
|
.subcommand(database_manager::cli_app())
|
||||||
|
.subcommand(validator_manager::cli_app())
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
// Configure the allocator early in the process, before it has the chance to use the default values for
|
// Configure the allocator early in the process, before it has the chance to use the default values for
|
||||||
@@ -498,6 +499,16 @@ fn run<E: EthSpec>(
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(sub_matches) = matches.subcommand_matches(account_manager::CMD) {
|
||||||
|
eprintln!("Running validator manager for {} network", network_name);
|
||||||
|
|
||||||
|
// Pass the entire `environment` to the account manager so it can run blocking operations.
|
||||||
|
validator_manager::run(sub_matches, environment)?;
|
||||||
|
|
||||||
|
// Exit as soon as account manager returns control.
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(sub_matches) = matches.subcommand_matches(database_manager::CMD) {
|
if let Some(sub_matches) = matches.subcommand_matches(database_manager::CMD) {
|
||||||
info!(log, "Running database manager for {} network", network_name);
|
info!(log, "Running database manager for {} network", network_name);
|
||||||
// Pass the entire `environment` to the database manager so it can run blocking operations.
|
// Pass the entire `environment` to the database manager so it can run blocking operations.
|
||||||
|
|||||||
@@ -15,19 +15,28 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run the account manager, returning an error if the operation did not succeed.
|
/// Run the account manager, returning an error if the operation did not succeed.
|
||||||
pub async fn run<'a, T: EthSpec>(
|
pub fn run<'a, T: EthSpec>(
|
||||||
matches: &'a ArgMatches<'a>,
|
matches: &'a ArgMatches<'a>,
|
||||||
env: Environment<T>,
|
mut env: Environment<T>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
let context = env.core_context();
|
||||||
|
|
||||||
|
context
|
||||||
|
.executor
|
||||||
|
// This `block_on_dangerous` call reasonable since it is at the very highest level of the
|
||||||
|
// application, the rest of which is all async. All other functions below this should be
|
||||||
|
// async and should never call `block_on_dangerous` themselves.
|
||||||
|
.block_on_dangerous(
|
||||||
|
async {
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
(validators::CMD, Some(matches)) => validators::cli_run(matches, env).await?,
|
(validators::CMD, Some(matches)) => validators::cli_run(matches, env).await,
|
||||||
(unknown, _) => {
|
(unknown, _) => Err(format!(
|
||||||
return Err(format!(
|
|
||||||
"{} is not a valid {} command. See --help.",
|
"{} is not a valid {} command. See --help.",
|
||||||
unknown, CMD
|
unknown, CMD
|
||||||
));
|
)),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"validator_manager",
|
||||||
Ok(())
|
)
|
||||||
|
.ok_or("Shutting down")?
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user