mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 23:37:56 +00:00
Move import queue out of sc-network (#12764)
* Move import queue out of `sc-network` Add supplementary asynchronous API for the import queue which means it can be run as an independent task and communicated with through the `ImportQueueService`. This commit removes removes block and justification imports from `sc-network` and provides `ChainSync` with a handle to import queue so it can import blocks and justifications. Polling of the import queue is moved complete out of `sc-network` and `sc_consensus::Link` is implemented for `ChainSyncInterfaceHandled` so the import queue can still influence the syncing process. * Fix tests * Apply review comments * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/network/sync/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -43,8 +43,8 @@ use sc_client_api::{
|
||||
};
|
||||
use sc_consensus::{
|
||||
BasicQueue, BlockCheckParams, BlockImport, BlockImportParams, BoxJustificationImport,
|
||||
ForkChoiceStrategy, ImportResult, JustificationImport, JustificationSyncLink, LongestChain,
|
||||
Verifier,
|
||||
ForkChoiceStrategy, ImportQueue, ImportResult, JustificationImport, JustificationSyncLink,
|
||||
LongestChain, Verifier,
|
||||
};
|
||||
use sc_network::{
|
||||
config::{NetworkConfiguration, RequestResponseConfig, Role, SyncMode},
|
||||
@@ -896,7 +896,9 @@ where
|
||||
block_announce_validator,
|
||||
network_config.max_parallel_downloads,
|
||||
Some(warp_sync),
|
||||
None,
|
||||
chain_sync_network_handle,
|
||||
import_queue.service(),
|
||||
block_request_protocol_config.name.clone(),
|
||||
state_request_protocol_config.name.clone(),
|
||||
Some(warp_protocol_config.name.clone()),
|
||||
@@ -915,9 +917,8 @@ where
|
||||
chain: client.clone(),
|
||||
protocol_id,
|
||||
fork_id,
|
||||
import_queue,
|
||||
chain_sync: Box::new(chain_sync),
|
||||
chain_sync_service,
|
||||
chain_sync_service: Box::new(chain_sync_service.clone()),
|
||||
metrics_registry: None,
|
||||
block_announce_config,
|
||||
request_response_protocol_configs: [
|
||||
@@ -936,6 +937,9 @@ where
|
||||
self.rt_handle().spawn(async move {
|
||||
chain_sync_network_provider.run(service).await;
|
||||
});
|
||||
self.rt_handle().spawn(async move {
|
||||
import_queue.run(Box::new(chain_sync_service)).await;
|
||||
});
|
||||
|
||||
self.mut_peers(move |peers| {
|
||||
for peer in peers.iter_mut() {
|
||||
|
||||
Reference in New Issue
Block a user