mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(db): record client version history (#7119)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use reth_db::open_db_read_only;
|
||||
use reth_db::{mdbx::DatabaseArguments, models::client_version::ClientVersion, open_db_read_only};
|
||||
use reth_primitives::{Address, ChainSpecBuilder, B256};
|
||||
use reth_provider::{
|
||||
AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider,
|
||||
@ -19,7 +19,10 @@ fn main() -> eyre::Result<()> {
|
||||
// doing in 2 steps.
|
||||
let db_path = std::env::var("RETH_DB_PATH")?;
|
||||
let db_path = Path::new(&db_path);
|
||||
let db = open_db_read_only(db_path.join("db").as_path(), Default::default())?;
|
||||
let db = open_db_read_only(
|
||||
db_path.join("db").as_path(),
|
||||
DatabaseArguments::new(ClientVersion::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?
|
||||
|
||||
@ -9,6 +9,7 @@ license.workspace = true
|
||||
futures.workspace = true
|
||||
jsonrpsee.workspace = true
|
||||
reth.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-node-ethereum.workspace = true
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
eyre.workspace = true
|
||||
|
||||
@ -17,6 +17,7 @@ use reth::{
|
||||
providers::{providers::BlockchainProvider, ProviderFactory},
|
||||
utils::db::open_db_read_only,
|
||||
};
|
||||
use reth_db::{mdbx::DatabaseArguments, models::client_version::ClientVersion};
|
||||
// Bringing up the RPC
|
||||
use reth::rpc::builder::{
|
||||
RethRpcModule, RpcModuleBuilder, RpcServerConfig, TransportRpcModuleConfig,
|
||||
@ -38,7 +39,10 @@ async fn main() -> eyre::Result<()> {
|
||||
// 1. Setup the DB
|
||||
let db_path = std::env::var("RETH_DB_PATH")?;
|
||||
let db_path = Path::new(&db_path);
|
||||
let db = Arc::new(open_db_read_only(db_path.join("db").as_path(), Default::default())?);
|
||||
let db = Arc::new(open_db_read_only(
|
||||
db_path.join("db").as_path(),
|
||||
DatabaseArguments::new(ClientVersion::default()),
|
||||
)?);
|
||||
let spec = Arc::new(ChainSpecBuilder::mainnet().build());
|
||||
let factory = ProviderFactory::new(db.clone(), spec.clone(), db_path.join("static_files"))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user