Allow bootstrapper to scrape libp2p address

This commit is contained in:
Paul Hauner
2019-08-15 16:41:02 +10:00
parent 4678524659
commit ce37f95861
8 changed files with 107 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
mod run;
use clap::{App, Arg};
use client::{Bootstrapper, ClientConfig, Eth2Config, GenesisState};
use client::{ClientConfig, Eth2Config};
use env_logger::{Builder, Env};
use eth2_config::{read_from_file, write_to_file};
use slog::{crit, o, warn, Drain, Level};
@@ -298,32 +298,6 @@ fn main() {
}
};
// If the `--bootstrap` flag is provided, overwrite the default configuration.
if let Some(server) = matches.value_of("bootstrap") {
// Set the genesis state source.
client_config.genesis_state = GenesisState::HttpBootstrap {
server: server.to_string(),
};
let bootstrapper = match Bootstrapper::from_server_string(server.to_string()) {
Ok(b) => b,
Err(e) => {
crit!(log, "Failed to load bootstrapper"; "error" => format!("{:?}", e));
return;
}
};
let enr = match bootstrapper.enr() {
Ok(b) => b,
Err(e) => {
crit!(log, "Failed to read ENR from bootstrap server"; "error" => format!("{:?}", e));
return;
}
};
client_config.network.boot_nodes.push(enr);
}
let eth2_config_path = data_dir.join(ETH2_CONFIG_FILENAME);
// Initialise the `Eth2Config`.