Add --bootstrap arg to beacon node

This commit is contained in:
Paul Hauner 2019-08-15 12:48:34 +10:00
parent c97b3b20cb
commit fda208b103
No known key found for this signature in database
GPG Key ID: 5E2CFF9B75FA63DF
2 changed files with 19 additions and 2 deletions

View File

@ -22,7 +22,7 @@ use tokio::timer::Interval;
pub use beacon_chain::BeaconChainTypes;
pub use beacon_chain_types::ClientType;
pub use beacon_chain_types::InitialiseBeaconChain;
pub use config::Config as ClientConfig;
pub use config::{Config as ClientConfig, GenesisState};
pub use eth2_config::Eth2Config;
/// Main beacon node client service. This provides the connection and initialisation of the clients

View File

@ -1,7 +1,7 @@
mod run;
use clap::{App, Arg};
use client::{ClientConfig, Eth2Config};
use client::{ClientConfig, Eth2Config, GenesisState};
use env_logger::{Builder, Env};
use eth2_config::{read_from_file, write_to_file};
use slog::{crit, o, warn, Drain, Level};
@ -200,6 +200,16 @@ fn main() {
.help("Sets the verbosity level")
.takes_value(true),
)
/*
* Bootstrap.
*/
.arg(
Arg::with_name("bootstrap")
.long("bootstrap")
.value_name("HTTP_SERVER")
.help("Load the genesis state and libp2p address from the HTTP API of another Lighthouse node.")
.takes_value(true)
)
.get_matches();
// build the initial logger
@ -288,6 +298,13 @@ fn main() {
}
};
// If the `--bootstrap` flag is provided, overwrite the default configuration.
if let Some(server) = matches.value_of("bootstrap") {
client_config.genesis_state = GenesisState::HttpBootstrap {
server: server.to_string(),
};
}
let eth2_config_path = data_dir.join(ETH2_CONFIG_FILENAME);
// Initialise the `Eth2Config`.