Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for paritytech/substrate#12489 #1766

Merged
merged 4 commits into from
Oct 17, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions client/relay-chain-minimal-node/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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>) {}
}