Repository navigation
Expand file tree
/
Copy pathpayload.rs
More file actions
45 lines (40 loc) · 1.38 KB
/
Copy pathpayload.rs
File metadata and controls
45 lines (40 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Payload service component for the node builder.
use std::future::Future;
use reth_node_api::NodeTypesWithEngine;
use reth_payload_builder::PayloadBuilderHandle;
use reth_transaction_pool::TransactionPool;
use crate::{BuilderContext, FullNodeTypes};
/// A type that knows how to spawn the payload service.
pub trait PayloadServiceBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Send {
/// Spawns the payload service and returns the handle to it.
///
/// The [`BuilderContext`] is provided to allow access to the node's configuration.
fn spawn_payload_service(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<
Output = eyre::Result<PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>>,
> + Send;
}
impl<Node, F, Fut, Pool> PayloadServiceBuilder<Node, Pool> for F
where
Node: FullNodeTypes,
Pool: TransactionPool,
F: Fn(&BuilderContext<Node>, Pool) -> Fut + Send,
Fut: Future<
Output = eyre::Result<
PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>,
>,
> + Send,
{
fn spawn_payload_service(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<
Output = eyre::Result<PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>>,
> + Send {
self(ctx, pool)
}
}