2019-02-14 01:09:18 +00:00
|
|
|
extern crate slog;
|
|
|
|
|
2019-02-27 23:24:27 +00:00
|
|
|
mod run;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
use clap::{App, Arg};
|
2019-03-01 01:45:01 +00:00
|
|
|
use client::ClientConfig;
|
2019-03-19 11:53:51 +00:00
|
|
|
use slog::{error, o, Drain};
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let decorator = slog_term::TermDecorator::new().build();
|
|
|
|
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
|
|
|
|
let drain = slog_async::Async::new(drain).build().fuse();
|
2019-02-27 23:24:27 +00:00
|
|
|
let logger = slog::Logger::root(drain, o!());
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
let matches = App::new("Lighthouse")
|
2019-02-27 23:24:27 +00:00
|
|
|
.version(version::version().as_str())
|
|
|
|
.author("Sigma Prime <contact@sigmaprime.io>")
|
2019-02-14 01:09:18 +00:00
|
|
|
.about("Eth 2.0 Client")
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("datadir")
|
|
|
|
.long("datadir")
|
|
|
|
.value_name("DIR")
|
|
|
|
.help("Data directory for keys and databases.")
|
|
|
|
.takes_value(true),
|
|
|
|
)
|
2019-02-27 23:24:27 +00:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("listen_address")
|
|
|
|
.long("listen_address")
|
|
|
|
.value_name("Listen Address")
|
|
|
|
.help("The Network address to listen for p2p connections.")
|
|
|
|
.takes_value(true),
|
|
|
|
)
|
2019-02-14 01:09:18 +00:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("port")
|
|
|
|
.long("port")
|
|
|
|
.value_name("PORT")
|
|
|
|
.help("Network listen port for p2p connections.")
|
|
|
|
.takes_value(true),
|
|
|
|
)
|
|
|
|
.get_matches();
|
|
|
|
|
2019-02-27 23:24:27 +00:00
|
|
|
// invalid arguments, panic
|
2019-03-01 01:45:01 +00:00
|
|
|
let config = ClientConfig::parse_args(matches, &logger).unwrap();
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-03-19 11:53:51 +00:00
|
|
|
match run::run_beacon_node(config, &logger) {
|
|
|
|
Ok(_) => {}
|
|
|
|
Err(e) => error!(logger, "Beacon node failed because {:?}", e),
|
|
|
|
}
|
2019-02-14 01:09:18 +00:00
|
|
|
}
|