feat(storage, mdbx): transaction manager (#6126)

This commit is contained in:
Alexey Shekhirin
2024-01-23 12:24:56 +00:00
committed by GitHub
parent 9a5120a883
commit a6f8e449f7
36 changed files with 821 additions and 262 deletions

View File

@@ -17,8 +17,8 @@ use std::path::Path;
fn main() -> eyre::Result<()> {
// Opens a RO handle to the database file.
// TODO: Should be able to do `ProviderFactory::new_with_db_path_ro(...)` instead of
// doing in 2 steps.
let db = open_db_read_only(Path::new(&std::env::var("RETH_DB_PATH")?), None)?;
// doing in 2 steps.
let db = open_db_read_only(Path::new(&std::env::var("RETH_DB_PATH")?), Default::default())?;
// Instantiate a provider factory for Ethereum mainnet using the provided DB.
// TODO: Should the DB version include the spec so that you do not need to specify it here?

View File

@@ -35,7 +35,10 @@ pub mod myrpc_ext;
#[tokio::main]
async fn main() -> eyre::Result<()> {
// 1. Setup the DB
let db = Arc::new(open_db_read_only(Path::new(&std::env::var("RETH_DB_PATH")?), None)?);
let db = Arc::new(open_db_read_only(
Path::new(&std::env::var("RETH_DB_PATH")?),
Default::default(),
)?);
let spec = Arc::new(ChainSpecBuilder::mainnet().build());
let factory = ProviderFactory::new(db.clone(), spec.clone());