mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Starts initialisation of beacon chain in the client
This commit is contained in:
@@ -21,31 +21,36 @@ use tokio::runtime::TaskExecutor;
|
||||
/// sub-services in multiple threads.
|
||||
pub struct Client<T: ClientTypes> {
|
||||
config: ClientConfig,
|
||||
// beacon_chain: Arc<BeaconChain<T, U, F>>,
|
||||
beacon_chain: Arc<BeaconChain<T::DB, T::SlotClock, T::ForkChoice>>,
|
||||
pub network: Arc<NetworkService>,
|
||||
pub exit: exit_future::Exit,
|
||||
pub exit_signal: Signal,
|
||||
log: slog::Logger,
|
||||
phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: ClientTypes> Client<T> {
|
||||
/// Generate an instance of the client. Spawn and link all internal subprocesses.
|
||||
pub fn new(
|
||||
config: ClientConfig,
|
||||
client_type: T,
|
||||
log: slog::Logger,
|
||||
executor: &TaskExecutor,
|
||||
) -> error::Result<Self> {
|
||||
let (exit_signal, exit) = exit_future::signal();
|
||||
|
||||
// TODO: generate a beacon_chain service.
|
||||
// generate a beacon chain
|
||||
let beacon_chain = client_type.initialise_beacon_chain(&config);
|
||||
|
||||
// Start the network service, libp2p and syncing threads
|
||||
// TODO: Add beacon_chain reference to network parameters
|
||||
let network_config = config.net_conf.clone();
|
||||
let network_config = &config.net_conf;
|
||||
let network_logger = log.new(o!("Service" => "Network"));
|
||||
let (network, network_send) =
|
||||
NetworkService::new(network_config, executor, network_logger)?;
|
||||
let (network, network_send) = NetworkService::new(
|
||||
beacon_chain.clone(),
|
||||
network_config,
|
||||
executor,
|
||||
network_logger,
|
||||
)?;
|
||||
|
||||
Ok(Client {
|
||||
config,
|
||||
|
||||
Reference in New Issue
Block a user