mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Merge branch 'master' into disk-db
This commit is contained in:
@@ -10,6 +10,7 @@ use std::path::PathBuf;
|
||||
use types::multiaddr::Protocol;
|
||||
use types::multiaddr::ToMultiaddr;
|
||||
use types::ChainSpec;
|
||||
use types::Multiaddr;
|
||||
|
||||
/// Stores the client configuration for this Lighthouse instance.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -76,7 +77,7 @@ impl ClientConfig {
|
||||
}
|
||||
// Custom listening address ipv4/ipv6
|
||||
// TODO: Handle list of addresses
|
||||
if let Some(listen_address_str) = args.value_of("listen_address") {
|
||||
if let Some(listen_address_str) = args.value_of("listen-address") {
|
||||
if let Ok(listen_address) = listen_address_str.parse::<IpAddr>() {
|
||||
let multiaddr = SocketAddr::new(listen_address, config.net_conf.listen_port)
|
||||
.to_multiaddr()
|
||||
@@ -88,6 +89,17 @@ impl ClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// Custom bootnodes
|
||||
// TODO: Handle list of addresses
|
||||
if let Some(boot_addresses_str) = args.value_of("boot-nodes") {
|
||||
if let Ok(boot_address) = boot_addresses_str.parse::<Multiaddr>() {
|
||||
config.net_conf.boot_nodes.append(&mut vec![boot_address]);
|
||||
} else {
|
||||
error!(log, "Invalid Bootnode multiaddress"; "Multiaddr" => boot_addresses_str);
|
||||
return Err("Invalid IP Address");
|
||||
}
|
||||
}
|
||||
|
||||
/* Filesystem related arguments */
|
||||
|
||||
// Custom datadir
|
||||
|
||||
@@ -15,21 +15,19 @@ use futures::{future::Future, Stream};
|
||||
use network::Service as NetworkService;
|
||||
use slog::{error, info, o};
|
||||
use slot_clock::SlotClock;
|
||||
use ssz::TreeHash;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::runtime::TaskExecutor;
|
||||
use tokio::timer::Interval;
|
||||
use types::Hash256;
|
||||
|
||||
/// Main beacon node client service. This provides the connection and initialisation of the clients
|
||||
/// sub-services in multiple threads.
|
||||
pub struct Client<T: ClientTypes> {
|
||||
/// Configuration for the lighthouse client.
|
||||
config: ClientConfig,
|
||||
_config: ClientConfig,
|
||||
/// The beacon chain for the running client.
|
||||
beacon_chain: Arc<BeaconChain<T::DB, T::SlotClock, T::ForkChoice>>,
|
||||
_beacon_chain: Arc<BeaconChain<T::DB, T::SlotClock, T::ForkChoice>>,
|
||||
/// Reference to the network service.
|
||||
pub network: Arc<NetworkService>,
|
||||
/// Signal to terminate the RPC server.
|
||||
@@ -92,17 +90,18 @@ impl<TClientType: ClientTypes> Client<TClientType> {
|
||||
network_logger,
|
||||
)?;
|
||||
|
||||
let mut rpc_exit_signal = None;
|
||||
// spawn the RPC server
|
||||
if config.rpc_conf.enabled {
|
||||
rpc_exit_signal = Some(rpc::start_server(
|
||||
let rpc_exit_signal = if config.rpc_conf.enabled {
|
||||
Some(rpc::start_server(
|
||||
&config.rpc_conf,
|
||||
executor,
|
||||
network_send,
|
||||
beacon_chain.clone(),
|
||||
&log,
|
||||
));
|
||||
}
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let (slot_timer_exit_signal, exit) = exit_future::signal();
|
||||
if let Ok(Some(duration_to_next_slot)) = beacon_chain.slot_clock.duration_to_next_slot() {
|
||||
@@ -131,8 +130,8 @@ impl<TClientType: ClientTypes> Client<TClientType> {
|
||||
}
|
||||
|
||||
Ok(Client {
|
||||
config,
|
||||
beacon_chain,
|
||||
_config: config,
|
||||
_beacon_chain: beacon_chain,
|
||||
rpc_exit_signal,
|
||||
slot_timer_exit_signal: Some(slot_timer_exit_signal),
|
||||
log,
|
||||
|
||||
@@ -14,7 +14,7 @@ pub fn run<T: ClientTypes>(client: &Client<T>, executor: TaskExecutor, exit: Exi
|
||||
// notification heartbeat
|
||||
let interval = Interval::new(Instant::now(), Duration::from_secs(5));
|
||||
|
||||
let log = client.log.new(o!("Service" => "Notifier"));
|
||||
let _log = client.log.new(o!("Service" => "Notifier"));
|
||||
|
||||
// TODO: Debugging only
|
||||
let counter = Arc::new(Mutex::new(0));
|
||||
|
||||
Reference in New Issue
Block a user