diff --git a/src/discv5.rs b/src/discv5.rs index 7e440fb5..5120fdb5 100644 --- a/src/discv5.rs +++ b/src/discv5.rs @@ -23,7 +23,7 @@ use crate::{ service::{QueryKind, Service, ServiceRequest, TalkRequest}, Config, DefaultProtocolId, Enr, IpMode, }; -use enr::{CombinedKey, EnrKey, Error as EnrError, NodeId}; +use enr::{CombinedKey, CombinedPublicKey ,EnrKey, Error as EnrError, NodeId}; use parking_lot::RwLock; use std::{ future::Future, @@ -82,9 +82,10 @@ pub enum Event { /// The main Discv5 Service struct. This provides the user-level API for performing queries and /// interacting with the underlying service. -pub struct Discv5

+pub struct Discv5

where P: ProtocolIdentity, + K: EnrKey, { config: Config, /// The channel to make requests from the main service. @@ -102,8 +103,11 @@ where /// Phantom for the protocol id. _phantom: PhantomData

, } - -impl Discv5 { +impl Discv5 +where + P: ProtocolIdentity, + K: EnrKey, + { pub fn new( local_enr: Enr, enr_key: K, @@ -737,7 +741,7 @@ impl Discv5 { } } -impl Drop for Discv5

{ +impl> Drop for Discv5 { fn drop(&mut self) { self.shutdown(); } diff --git a/src/service.rs b/src/service.rs index 8b409398..ecc680ef 100644 --- a/src/service.rs +++ b/src/service.rs @@ -17,6 +17,7 @@ use self::{ ip_vote::IpVote, query_info::{QueryInfo, QueryType}, }; +use enr::EnrKey; use crate::{ error::{RequestError, ResponseError}, handler::{Handler, HandlerIn, HandlerOut}, @@ -268,7 +269,7 @@ impl Default for NodesResponse { } } -impl Service { +impl Service { /// Builds the `Service` main struct. /// /// `local_enr` is the `ENR` representing the local node. This contains node identifying information, such @@ -276,7 +277,7 @@ impl Service { /// mechanism. pub async fn spawn( local_enr: Arc>, - enr_key: Arc>, + enr_key: Arc>, kbuckets: Arc>>, config: Config, ) -> Result<(oneshot::Sender<()>, mpsc::Sender), std::io::Error> {