feat: run StaticFileProvider::check_consistency on start up (#8143)

This commit is contained in:
joshieDo
2024-06-01 12:56:13 +02:00
committed by GitHub
parent 105570ded0
commit a4df6bbd62
58 changed files with 1335 additions and 262 deletions

View File

@ -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.