chore: add a few missing trait bounds (#8731)

This commit is contained in:
Matthias Seitz
2024-06-11 10:53:14 +02:00
committed by GitHub
parent 218526c1f9
commit e9d8cdab49
2 changed files with 10 additions and 4 deletions

View File

@ -19,7 +19,7 @@ use std::marker::PhantomData;
/// consensus layer.
///
/// This trait is intended to be stateless and only define the types of the node.
pub trait NodeTypes: Send + Sync + 'static {
pub trait NodeTypes: Send + Sync + Unpin + 'static {
/// The node's primitive types, defining basic operations and structures.
type Primitives: NodePrimitives;
/// The node's engine types, defining the interaction with the consensus engine.
@ -61,11 +61,17 @@ impl<Types, DB, Provider> Default for FullNodeTypesAdapter<Types, DB, Provider>
}
}
impl<Types, DB, Provider> Clone for FullNodeTypesAdapter<Types, DB, Provider> {
fn clone(&self) -> Self {
Self { types: self.types, db: self.db, provider: self.provider }
}
}
impl<Types, DB, Provider> NodeTypes for FullNodeTypesAdapter<Types, DB, Provider>
where
Types: NodeTypes,
DB: Send + Sync + 'static,
Provider: Send + Sync + 'static,
DB: Send + Sync + Unpin + 'static,
Provider: Send + Sync + Unpin + 'static,
{
type Primitives = Types::Primitives;
type Engine = Types::Engine;

View File

@ -29,7 +29,7 @@ mod pool;
/// - transaction pool
/// - network
/// - payload builder.
pub trait NodeComponents<NodeTypes: FullNodeTypes>: Clone + Send + Sync + 'static {
pub trait NodeComponents<NodeTypes: FullNodeTypes>: Clone + Unpin + Send + Sync + 'static {
/// The transaction pool of the node.
type Pool: TransactionPool + Unpin;