Make BeaconChainTypes Send + Sync + 'static

This commit is contained in:
Paul Hauner
2019-08-22 16:34:21 +10:00
parent 5a34f86e77
commit 853344af8a
8 changed files with 19 additions and 23 deletions

View File

@@ -71,7 +71,7 @@ impl From<state_processing::per_slot_processing::Error> for ApiError {
}
}
pub fn start_server<T: BeaconChainTypes + Clone + Send + Sync + 'static>(
pub fn start_server<T: BeaconChainTypes>(
config: &ApiConfig,
executor: &TaskExecutor,
beacon_chain: Arc<BeaconChain<T>>,

View File

@@ -7,9 +7,7 @@ use std::sync::Arc;
/// HTTP handle to return the list of libp2p multiaddr the client is listening on.
///
/// Returns a list of `Multiaddr`, serialized according to their `serde` impl.
pub fn get_listen_addresses<T: BeaconChainTypes + Send + Sync + 'static>(
req: Request<Body>,
) -> ApiResult {
pub fn get_listen_addresses<T: BeaconChainTypes>(req: Request<Body>) -> ApiResult {
let network = req
.extensions()
.get::<Arc<NetworkService<T>>>()
@@ -26,7 +24,7 @@ pub fn get_listen_addresses<T: BeaconChainTypes + Send + Sync + 'static>(
/// HTTP handle to return the Discv5 ENR from the client's libp2p service.
///
/// ENR is encoded as base64 string.
pub fn get_enr<T: BeaconChainTypes + Send + Sync + 'static>(req: Request<Body>) -> ApiResult {
pub fn get_enr<T: BeaconChainTypes>(req: Request<Body>) -> ApiResult {
let network = req
.extensions()
.get::<Arc<NetworkService<T>>>()
@@ -43,7 +41,7 @@ pub fn get_enr<T: BeaconChainTypes + Send + Sync + 'static>(req: Request<Body>)
/// HTTP handle to return the `PeerId` from the client's libp2p service.
///
/// PeerId is encoded as base58 string.
pub fn get_peer_id<T: BeaconChainTypes + Send + Sync + 'static>(req: Request<Body>) -> ApiResult {
pub fn get_peer_id<T: BeaconChainTypes>(req: Request<Body>) -> ApiResult {
let network = req
.extensions()
.get::<Arc<NetworkService<T>>>()
@@ -58,9 +56,7 @@ pub fn get_peer_id<T: BeaconChainTypes + Send + Sync + 'static>(req: Request<Bod
}
/// HTTP handle to return the number of peers connected in the client's libp2p service.
pub fn get_peer_count<T: BeaconChainTypes + Send + Sync + 'static>(
req: Request<Body>,
) -> ApiResult {
pub fn get_peer_count<T: BeaconChainTypes>(req: Request<Body>) -> ApiResult {
let network = req
.extensions()
.get::<Arc<NetworkService<T>>>()
@@ -77,7 +73,7 @@ pub fn get_peer_count<T: BeaconChainTypes + Send + Sync + 'static>(
/// HTTP handle to return the list of peers connected to the client's libp2p service.
///
/// Peers are presented as a list of `PeerId::to_string()`.
pub fn get_peer_list<T: BeaconChainTypes + Send + Sync + 'static>(req: Request<Body>) -> ApiResult {
pub fn get_peer_list<T: BeaconChainTypes>(req: Request<Body>) -> ApiResult {
let network = req
.extensions()
.get::<Arc<NetworkService<T>>>()