mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
feat: make load_network_config and lookup_head generic over DB (#5692)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -744,7 +744,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
/// Fetches the head block from the database.
|
||||
///
|
||||
/// If the database is empty, returns the genesis block.
|
||||
fn lookup_head(&self, db: Arc<DatabaseEnv>) -> RethResult<Head> {
|
||||
fn lookup_head<DB: Database>(&self, db: DB) -> RethResult<Head> {
|
||||
let factory = ProviderFactory::new(db, self.chain.clone());
|
||||
let provider = factory.provider()?;
|
||||
|
||||
@@ -826,15 +826,15 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_network_config(
|
||||
fn load_network_config<DB: Database>(
|
||||
&self,
|
||||
config: &Config,
|
||||
db: Arc<DatabaseEnv>,
|
||||
db: DB,
|
||||
executor: TaskExecutor,
|
||||
head: Head,
|
||||
secret_key: SecretKey,
|
||||
default_peers_path: PathBuf,
|
||||
) -> NetworkConfig<ProviderFactory<Arc<DatabaseEnv>>> {
|
||||
) -> NetworkConfig<ProviderFactory<DB>> {
|
||||
let cfg_builder = self
|
||||
.network
|
||||
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
|
||||
|
||||
Reference in New Issue
Block a user