MCPcopy Create free account
hub / github.com/base/base / into_node_builder

Method into_node_builder

crates/execution/cli/src/node.rs:261–293  ·  view source on GitHub ↗

Converts the runtime config into a reth node builder.

(mut self, ctx: CliContext)

Source from the content-addressed store, hash-verified

259
260 /// Converts the runtime config into a reth node builder.
261 pub fn into_node_builder<Rpc>(mut self, ctx: CliContext) -> eyre::Result<BaseNodeBuilder>
262 where
263 Rpc: RpcModuleValidator,
264 {
265 if let Some(http_api) = &self.node_config.rpc.http_api {
266 Rpc::validate_selection(http_api, "http.api").map_err(|e| eyre::eyre!("{e}"))?;
267 }
268 if let Some(ws_api) = &self.node_config.rpc.ws_api {
269 Rpc::validate_selection(ws_api, "ws.api").map_err(|e| eyre::eyre!("{e}"))?;
270 }
271
272 info!(
273 target: "reth::cli",
274 version = ?version::version_metadata().short_version,
275 client = %version::version_metadata().name_client,
276 "Starting client"
277 );
278
279 if self.with_unused_ports {
280 self.node_config = self.node_config.with_unused_ports();
281 }
282
283 let data_dir = self.node_config.datadir();
284 let db_path = data_dir.db();
285 info!(target: "reth::cli", path = ?db_path, "Opening database");
286 let database = init_db(db_path, self.node_config.db.database_args())?.with_metrics();
287
288 let builder = NodeBuilder::new(self.node_config)
289 .with_database(database)
290 .with_launch_context(ctx.task_executor);
291
292 Ok(builder)
293 }
294
295 /// Converts the runtime config into a reth node builder with the default RPC validator.
296 pub fn into_default_node_builder(self, ctx: CliContext) -> eyre::Result<BaseNodeBuilder> {

Callers

nothing calls this directly

Calls 2

newFunction · 0.50
datadirMethod · 0.45

Tested by

no test coverage detected