Fix clippy lints

This commit is contained in:
Paul Hauner
2019-05-09 13:35:00 +10:00
parent 0ac278f44d
commit 2a938f2fd5
13 changed files with 20 additions and 23 deletions

View File

@@ -1,16 +1,13 @@
use crate::ClientConfig;
use crate::{ArcBeaconChain, ClientConfig};
use beacon_chain::{
db::{ClientDB, DiskDB, MemoryDB},
fork_choice::BitwiseLMDGhost,
initialise,
slot_clock::{SlotClock, SystemTimeSlotClock},
BeaconChain,
};
use fork_choice::ForkChoice;
use types::{BeaconStateTypes, FewValidatorsStateTypes, FoundationStateTypes};
use std::sync::Arc;
pub trait ClientTypes {
type DB: ClientDB + 'static;
type SlotClock: SlotClock + 'static;
@@ -19,7 +16,7 @@ pub trait ClientTypes {
fn initialise_beacon_chain(
config: &ClientConfig,
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>>;
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>;
}
pub struct StandardClientType;
@@ -32,7 +29,7 @@ impl ClientTypes for StandardClientType {
fn initialise_beacon_chain(
config: &ClientConfig,
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>> {
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes> {
initialise::initialise_beacon_chain(&config.spec, Some(&config.db_name))
}
}
@@ -47,7 +44,7 @@ impl ClientTypes for TestingClientType {
fn initialise_beacon_chain(
config: &ClientConfig,
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>> {
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes> {
initialise::initialise_test_beacon_chain(&config.spec, None)
}
}

View File

@@ -22,13 +22,15 @@ use tokio::runtime::TaskExecutor;
use tokio::timer::Interval;
use types::BeaconStateTypes;
type ArcBeaconChain<D, S, F, B> = Arc<BeaconChain<D, S, F, B>>;
/// 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,
/// The beacon chain for the running client.
_beacon_chain: Arc<BeaconChain<T::DB, T::SlotClock, T::ForkChoice, T::BeaconStateTypes>>,
_beacon_chain: ArcBeaconChain<T::DB, T::SlotClock, T::ForkChoice, T::BeaconStateTypes>,
/// Reference to the network service.
pub network: Arc<NetworkService<T::BeaconStateTypes>>,
/// Signal to terminate the RPC server.