mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: run StaticFileProvider::check_consistency on start up (#8143)
This commit is contained in:
@ -25,7 +25,7 @@ use reth_storage_errors::provider::ProviderResult;
|
||||
use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg};
|
||||
use std::{
|
||||
ops::{RangeBounds, RangeInclusive},
|
||||
path::{Path, PathBuf},
|
||||
path::Path,
|
||||
sync::Arc,
|
||||
};
|
||||
use tracing::trace;
|
||||
@ -53,13 +53,9 @@ impl<DB> ProviderFactory<DB> {
|
||||
pub fn new(
|
||||
db: DB,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
static_files_path: PathBuf,
|
||||
) -> ProviderResult<Self> {
|
||||
Ok(Self {
|
||||
db: Arc::new(db),
|
||||
chain_spec,
|
||||
static_file_provider: StaticFileProvider::new(static_files_path)?,
|
||||
})
|
||||
static_file_provider: StaticFileProvider,
|
||||
) -> Self {
|
||||
Self { db: Arc::new(db), chain_spec, static_file_provider }
|
||||
}
|
||||
|
||||
/// Enables metrics on the static file provider.
|
||||
@ -87,12 +83,12 @@ impl ProviderFactory<DatabaseEnv> {
|
||||
path: P,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
args: DatabaseArguments,
|
||||
static_files_path: PathBuf,
|
||||
static_file_provider: StaticFileProvider,
|
||||
) -> RethResult<Self> {
|
||||
Ok(Self {
|
||||
db: Arc::new(init_db(path, args).map_err(RethError::msg)?),
|
||||
chain_spec,
|
||||
static_file_provider: StaticFileProvider::new(static_files_path)?,
|
||||
static_file_provider,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -588,8 +584,10 @@ impl<DB> Clone for ProviderFactory<DB> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
providers::StaticFileWriter, test_utils::create_test_provider_factory, BlockHashReader,
|
||||
BlockNumReader, BlockWriter, HeaderSyncGapProvider, HeaderSyncMode, TransactionsProvider,
|
||||
providers::{StaticFileProvider, StaticFileWriter},
|
||||
test_utils::create_test_provider_factory,
|
||||
BlockHashReader, BlockNumReader, BlockWriter, HeaderSyncGapProvider, HeaderSyncMode,
|
||||
TransactionsProvider,
|
||||
};
|
||||
use alloy_rlp::Decodable;
|
||||
use assert_matches::assert_matches;
|
||||
@ -645,7 +643,7 @@ mod tests {
|
||||
tempfile::TempDir::new().expect(ERROR_TEMPDIR).into_path(),
|
||||
Arc::new(chain_spec),
|
||||
DatabaseArguments::new(Default::default()),
|
||||
static_dir_path,
|
||||
StaticFileProvider::read_write(static_dir_path).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user