mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
feat: public ::new() for BuilderContext (#7358)
This commit is contained in:
@@ -523,14 +523,7 @@ where
|
||||
let blockchain_db =
|
||||
BlockchainProvider::new(provider_factory.clone(), blockchain_tree.clone())?;
|
||||
|
||||
let ctx = BuilderContext {
|
||||
head,
|
||||
provider: blockchain_db,
|
||||
executor,
|
||||
data_dir,
|
||||
config,
|
||||
reth_config,
|
||||
};
|
||||
let ctx = BuilderContext::new(head, blockchain_db, executor, data_dir, config, reth_config);
|
||||
|
||||
debug!(target: "reth::cli", "creating components");
|
||||
let NodeComponents { transaction_pool, network, payload_builder } =
|
||||
@@ -1083,6 +1076,18 @@ pub struct BuilderContext<Node: FullNodeTypes> {
|
||||
}
|
||||
|
||||
impl<Node: FullNodeTypes> BuilderContext<Node> {
|
||||
/// Create a new instance of [BuilderContext]
|
||||
pub fn new(
|
||||
head: Head,
|
||||
provider: Node::Provider,
|
||||
executor: TaskExecutor,
|
||||
data_dir: ChainPath<DataDirPath>,
|
||||
config: NodeConfig,
|
||||
reth_config: reth_config::Config,
|
||||
) -> Self {
|
||||
Self { head, provider, executor, data_dir, config, reth_config }
|
||||
}
|
||||
|
||||
/// Returns the configured provider to interact with the blockchain.
|
||||
pub fn provider(&self) -> &Node::Provider {
|
||||
&self.provider
|
||||
|
||||
Reference in New Issue
Block a user