mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +00:00
Add http server to beacon node w/ hello world
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use clap::ArgMatches;
|
||||
use fork_choice::ForkChoiceAlgorithm;
|
||||
use http_server::HttpServerConfig;
|
||||
use network::NetworkConfig;
|
||||
use slog::error;
|
||||
use std::fs;
|
||||
@@ -27,7 +28,7 @@ pub struct ClientConfig {
|
||||
pub db_type: DBType,
|
||||
pub db_name: PathBuf,
|
||||
pub rpc_conf: rpc::RPCConfig,
|
||||
//pub ipc_conf:
|
||||
pub http_conf: HttpServerConfig, //pub ipc_conf:
|
||||
}
|
||||
|
||||
impl Default for ClientConfig {
|
||||
@@ -55,6 +56,7 @@ impl Default for ClientConfig {
|
||||
// default db name for disk-based dbs
|
||||
db_name: data_dir.join("chain_db"),
|
||||
rpc_conf: rpc::RPCConfig::default(),
|
||||
http_conf: HttpServerConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ impl<TClientType: ClientTypes> Client<TClientType> {
|
||||
Some(rpc::start_server(
|
||||
&config.rpc_conf,
|
||||
executor,
|
||||
network_send,
|
||||
network_send.clone(),
|
||||
beacon_chain.clone(),
|
||||
&log,
|
||||
))
|
||||
@@ -106,6 +106,17 @@ impl<TClientType: ClientTypes> Client<TClientType> {
|
||||
None
|
||||
};
|
||||
|
||||
// Start the `http_server` service.
|
||||
//
|
||||
// Note: presently we are ignoring the config and _always_ starting a HTTP server.
|
||||
http_server::start_service(
|
||||
&config.http_conf,
|
||||
executor,
|
||||
network_send,
|
||||
beacon_chain.clone(),
|
||||
&log,
|
||||
);
|
||||
|
||||
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() {
|
||||
// set up the validator work interval - start at next slot and proceed every slot
|
||||
|
||||
Reference in New Issue
Block a user