use crate::{BuilderContext, FullNodeTypes};
use reth_transaction_pool::TransactionPool;
use std::future::Future;
pub trait PoolBuilder<Node: FullNodeTypes>: Send {
type Pool: TransactionPool + Unpin + 'static;
fn build_pool(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Self::Pool>> + Send;
}
impl<Node, F, Fut, Pool> PoolBuilder<Node> for F
where
Node: FullNodeTypes,
Pool: TransactionPool + Unpin + 'static,
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
Fut: Future<Output = eyre::Result<Pool>> + Send,
{
type Pool = Pool;
fn build_pool(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Self::Pool>> {
self(ctx)
}
}