mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
feat: integrate builder (#6611)
This commit is contained in:
@@ -14,6 +14,7 @@ use reth_node_core::{
|
||||
},
|
||||
},
|
||||
};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_rpc::JwtSecret;
|
||||
use reth_tasks::TaskExecutor;
|
||||
use reth_tracing::tracing::{debug, info};
|
||||
@@ -94,7 +95,7 @@ impl<Node: FullNodeComponents> fmt::Debug for RpcHooks<Node> {
|
||||
}
|
||||
|
||||
/// Event hook that is called once the rpc server is started.
|
||||
pub trait OnRpcStarted<Node: FullNodeComponents> {
|
||||
pub trait OnRpcStarted<Node: FullNodeComponents>: Send {
|
||||
/// The hook that is called once the rpc server is started.
|
||||
fn on_rpc_started(
|
||||
&self,
|
||||
@@ -105,7 +106,7 @@ pub trait OnRpcStarted<Node: FullNodeComponents> {
|
||||
|
||||
impl<Node, F> OnRpcStarted<Node> for F
|
||||
where
|
||||
F: Fn(RpcContext<'_, Node>, RethRpcServerHandles) -> eyre::Result<()>,
|
||||
F: Fn(RpcContext<'_, Node>, RethRpcServerHandles) -> eyre::Result<()> + Send,
|
||||
Node: FullNodeComponents,
|
||||
{
|
||||
fn on_rpc_started(
|
||||
@@ -124,14 +125,14 @@ impl<Node: FullNodeComponents> OnRpcStarted<Node> for () {
|
||||
}
|
||||
|
||||
/// Event hook that is called when the rpc server is started.
|
||||
pub trait ExtendRpcModules<Node: FullNodeComponents> {
|
||||
pub trait ExtendRpcModules<Node: FullNodeComponents>: Send {
|
||||
/// The hook that is called once the rpc server is started.
|
||||
fn extend_rpc_modules(&self, ctx: RpcContext<'_, Node>) -> eyre::Result<()>;
|
||||
}
|
||||
|
||||
impl<Node, F> ExtendRpcModules<Node> for F
|
||||
where
|
||||
F: Fn(RpcContext<'_, Node>) -> eyre::Result<()>,
|
||||
F: Fn(RpcContext<'_, Node>) -> eyre::Result<()> + Send,
|
||||
Node: FullNodeComponents,
|
||||
{
|
||||
fn extend_rpc_modules(&self, ctx: RpcContext<'_, Node>) -> eyre::Result<()> {
|
||||
@@ -223,6 +224,26 @@ impl<'a, Node: FullNodeComponents> RpcContext<'a, Node> {
|
||||
pub fn node(&self) -> &Node {
|
||||
&self.node
|
||||
}
|
||||
|
||||
/// Returns the transaction pool instance.
|
||||
pub fn pool(&self) -> &Node::Pool {
|
||||
self.node.pool()
|
||||
}
|
||||
|
||||
/// Returns provider to interact with the node.
|
||||
pub fn provider(&self) -> &Node::Provider {
|
||||
self.node.provider()
|
||||
}
|
||||
|
||||
/// Returns the handle to the network
|
||||
pub fn network(&self) -> &NetworkHandle {
|
||||
self.node.network()
|
||||
}
|
||||
|
||||
/// Returns the handle to the payload builder service
|
||||
pub fn payload_builder(&self) -> &PayloadBuilderHandle<Node::Engine> {
|
||||
self.node.payload_builder()
|
||||
}
|
||||
}
|
||||
|
||||
/// Launch the rpc servers.
|
||||
|
||||
Reference in New Issue
Block a user