From e2e09b428113cbafb3764a25a1f0e6d213a726be Mon Sep 17 00:00:00 2001 From: grantkee <49913008+grantkee@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:50:11 -0500 Subject: [PATCH] feat: public ::new() for BuilderContext (#7358) --- crates/node-builder/src/builder.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/crates/node-builder/src/builder.rs b/crates/node-builder/src/builder.rs index f7865a08f4..ae90d7928d 100644 --- a/crates/node-builder/src/builder.rs +++ b/crates/node-builder/src/builder.rs @@ -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 { } impl BuilderContext { + /// Create a new instance of [BuilderContext] + pub fn new( + head: Head, + provider: Node::Provider, + executor: TaskExecutor, + data_dir: ChainPath, + 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