chore(downloader): replace database with header provider (#5472)

This commit is contained in:
Roman Krasiuk
2023-11-18 00:16:19 -08:00
committed by GitHub
parent 6ded64355e
commit d05dda72dd
13 changed files with 123 additions and 103 deletions

View File

@ -147,7 +147,11 @@ impl ImportCommand {
.into_task();
let body_downloader = BodiesDownloaderBuilder::from(config.stages.bodies)
.build(file_client.clone(), consensus.clone(), db.clone())
.build(
file_client.clone(),
consensus.clone(),
ProviderFactory::new(db.clone(), self.chain.clone()),
)
.into_task();
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);

View File

@ -102,7 +102,11 @@ impl Command {
.into_task_with(task_executor);
let body_downloader = BodiesDownloaderBuilder::from(config.stages.bodies)
.build(client, Arc::clone(&consensus), db.clone())
.build(
client,
Arc::clone(&consensus),
ProviderFactory::new(db.clone(), self.chain.clone()),
)
.into_task_with(task_executor);
let stage_conf = &config.stages;

View File

@ -617,7 +617,11 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
.into_task_with(task_executor);
let body_downloader = BodiesDownloaderBuilder::from(config.stages.bodies)
.build(client, Arc::clone(&consensus), db.clone())
.build(
client,
Arc::clone(&consensus),
ProviderFactory::new(db.clone(), self.chain.clone()),
)
.into_task_with(task_executor);
let pipeline = self

View File

@ -163,6 +163,9 @@ impl Command {
let default_peers_path = data_dir.known_peers_path();
let provider_factory =
Arc::new(ProviderFactory::new(db.clone(), self.chain.clone()));
let network = self
.network
.network_config(
@ -171,7 +174,7 @@ impl Command {
p2p_secret_key,
default_peers_path,
)
.build(Arc::new(ProviderFactory::new(db.clone(), self.chain.clone())))
.build(provider_factory.clone())
.start_network()
.await?;
let fetch_client = Arc::new(network.fetch_client().await?);
@ -187,9 +190,8 @@ impl Command {
config.stages.bodies.downloader_min_concurrent_requests..=
config.stages.bodies.downloader_max_concurrent_requests,
)
.build(fetch_client, consensus.clone(), db.clone()),
.build(fetch_client, consensus.clone(), provider_factory),
);
(Box::new(stage), None)
}
StageEnum::Senders => (Box::new(SenderRecoveryStage::new(batch_size)), None),