Companion for paritytech/substrate#12489 (#1766)

* Companion for paritytech/substrate#12489

* fmt

* update lockfile for {"polkadot", "substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Aaro Altonen
2022-10-17 10:49:55 +03:00
committed by GitHub
parent 48b3a122ef
commit aa5dd3d8e0
2 changed files with 270 additions and 252 deletions
+254 -252
View File
File diff suppressed because it is too large Load Diff
@@ -26,6 +26,7 @@ use sc_network_common::{
NonDefaultSetConfig, NonReservedPeerMode, NotificationHandshake, ProtocolId, SetConfig,
},
protocol::role::Roles,
service::NetworkSyncForkRequest,
sync::{message::BlockAnnouncesHandshake, Metrics, SyncStatus},
};
use sc_network_light::light_client_requests;
@@ -92,6 +93,7 @@ pub(crate) fn build_collator_network(
protocol_id,
metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()),
block_announce_config,
chain_sync_service: Box::new(DummyChainSyncService::<Block>(Default::default())),
block_request_protocol_config,
state_request_protocol_config,
warp_sync_protocol_config: None,
@@ -420,6 +422,14 @@ impl<B: BlockT> sc_network_common::sync::ChainSync<B> for DummyChainSync {
) -> Result<sc_network_common::sync::OpaqueStateResponse, String> {
unimplemented!("Not supported on the RPC collator")
}
fn poll(
&mut self,
_cx: &mut std::task::Context,
) -> std::task::Poll<sc_network_common::sync::PollBlockAnnounceValidation<<B as BlockT>::Header>>
{
std::task::Poll::Pending
}
}
struct DummyImportQueue;
@@ -448,3 +458,9 @@ impl sc_service::ImportQueue<Block> for DummyImportQueue {
) {
}
}
struct DummyChainSyncService<B>(std::marker::PhantomData<B>);
impl<B: BlockT> NetworkSyncForkRequest<B::Hash, NumberFor<B>> for DummyChainSyncService<B> {
fn set_sync_fork_request(&self, _peers: Vec<PeerId>, _hash: B::Hash, _number: NumberFor<B>) {}
}