refactor: move mdbx::test-utils to reth_db::test-utils and add DatabaseEnvRO (#3466)

This commit is contained in:
joshieDo
2023-06-30 00:52:26 +01:00
committed by GitHub
parent 7850cc0b8d
commit c3ea430e4a
39 changed files with 227 additions and 213 deletions

View File

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