mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: run StaticFileProvider::check_consistency on start up (#8143)
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
use reth_db::open_db_read_only;
|
||||
use reth_primitives::{Address, ChainSpecBuilder, B256};
|
||||
use reth_provider::{
|
||||
AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider,
|
||||
StateProvider, TransactionsProvider,
|
||||
providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider,
|
||||
ProviderFactory, ReceiptProvider, StateProvider, TransactionsProvider,
|
||||
};
|
||||
use reth_rpc_types::{Filter, FilteredParams};
|
||||
use std::path::Path;
|
||||
@ -24,7 +24,11 @@ fn main() -> eyre::Result<()> {
|
||||
// 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?
|
||||
let spec = ChainSpecBuilder::mainnet().build();
|
||||
let factory = ProviderFactory::new(db, spec.into(), db_path.join("static_files"))?;
|
||||
let factory = ProviderFactory::new(
|
||||
db,
|
||||
spec.into(),
|
||||
StaticFileProvider::read_only(db_path.join("static_files"))?,
|
||||
);
|
||||
|
||||
// This call opens a RO transaction on the database. To write to the DB you'd need to call
|
||||
// the `provider_rw` function and look for the `Writer` variants of the traits.
|
||||
|
||||
Reference in New Issue
Block a user