fix(cmd-p2p): split off create_db from init_db (#7265)

This commit is contained in:
joshieDo
2024-03-21 11:22:57 +00:00
committed by GitHub
parent ffbe8be2aa
commit 1a42b0929f
2 changed files with 22 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ use crate::{
use backon::{ConstantBuilder, Retryable};
use clap::{Parser, Subcommand};
use reth_config::Config;
use reth_db::open_db;
use reth_db::create_db;
use reth_discv4::NatResolver;
use reth_interfaces::p2p::bodies::client::BodiesClient;
use reth_primitives::{BlockHashOrNumber, ChainSpec, NodeRecord};
@@ -100,7 +100,7 @@ impl Command {
/// Execute `p2p` command
pub async fn execute(&self) -> eyre::Result<()> {
let tempdir = tempfile::TempDir::new()?;
let noop_db = Arc::new(open_db(&tempdir.into_path(), self.db.database_args())?);
let noop_db = Arc::new(create_db(tempdir.into_path(), self.db.database_args())?);
// add network name to data dir
let data_dir = self.datadir.unwrap_or_chain_default(self.chain.chain);