feat(exex): add Pool to ExExContext (#7573)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Alexey Shekhirin
2024-04-12 17:34:18 +01:00
committed by GitHub
parent 7918759b2f
commit 2dcc01210c
6 changed files with 23 additions and 16 deletions

View File

@ -610,6 +610,7 @@ where
data_dir: data_dir.clone(),
config: config.clone(),
reth_config: reth_config.clone(),
pool: transaction_pool.clone(),
events,
notifications,
};

View File

@ -1,11 +1,11 @@
//! Types for launching execution extensions (ExEx).
use crate::FullNodeTypes;
use futures::{future::BoxFuture, FutureExt};
use reth_exex::ExExContext;
use reth_node_api::FullNodeComponents;
use std::future::Future;
/// A trait for launching an ExEx.
trait LaunchExEx<Node: FullNodeTypes>: Send {
trait LaunchExEx<Node: FullNodeComponents>: Send {
/// Launches the ExEx.
///
/// The ExEx should be able to run independently and emit events on the channels provided in
@ -19,7 +19,7 @@ trait LaunchExEx<Node: FullNodeTypes>: Send {
type BoxExEx = BoxFuture<'static, eyre::Result<()>>;
/// A version of [LaunchExEx] that returns a boxed future. Makes the trait object-safe.
pub(crate) trait BoxedLaunchExEx<Node: FullNodeTypes>: Send {
pub(crate) trait BoxedLaunchExEx<Node: FullNodeComponents>: Send {
fn launch(self: Box<Self>, ctx: ExExContext<Node>)
-> BoxFuture<'static, eyre::Result<BoxExEx>>;
}
@ -30,7 +30,7 @@ pub(crate) trait BoxedLaunchExEx<Node: FullNodeTypes>: Send {
impl<E, Node> BoxedLaunchExEx<Node> for E
where
E: LaunchExEx<Node> + Send + 'static,
Node: FullNodeTypes,
Node: FullNodeComponents,
{
fn launch(
self: Box<Self>,
@ -48,7 +48,7 @@ where
/// resolving to an ExEx.
impl<Node, F, Fut, E> LaunchExEx<Node> for F
where
Node: FullNodeTypes,
Node: FullNodeComponents,
F: FnOnce(ExExContext<Node>) -> Fut + Send,
Fut: Future<Output = eyre::Result<E>> + Send,
E: Future<Output = eyre::Result<()>> + Send,