mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 01:51:02 +00:00
Simplify trait bounds in network to prepare for collator-rpc (#12082)
* Hack towards PoC * Abstract away runtime requirement * blockchainevents * Remove bitswap * Remove unused sync more * Remove unused features in network * Re-enable bitswap change * Remove `Chain` trait bound * Reimplement blockchain-rpc-events * Move network to cumulus * Make AuthorityDiscovery async * Remove `ProofProvider` requirement from network behaviour * Extract bitswap * Adjustments after merge * Remove HeaderMetadata trait from network * Introduce NetworkHeaderBackend * Add comments * Improve comments * Move NetworkHeaderBackend to new module * Improve naming, remove redundand send + sync * Clean up generics * Fix CI * Improve comment and readability * Remove NetworkHeaderBackend * Fix Cargo.lock Co-authored-by: Sebastian Kunert <skunert@Sebastians-MacBook-Pro.fritz.box>
This commit is contained in:
@@ -37,7 +37,7 @@ use sc_client_db::{Backend, DatabaseSettings};
|
||||
use sc_consensus::import_queue::ImportQueue;
|
||||
use sc_executor::RuntimeVersionOf;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_network::{config::SyncMode, NetworkService};
|
||||
use sc_network::{bitswap::Bitswap, config::SyncMode, NetworkService};
|
||||
use sc_network_common::{
|
||||
service::{NetworkStateInfo, NetworkStatusProvider, NetworkTransaction},
|
||||
sync::warp::WarpSyncProvider,
|
||||
@@ -711,7 +711,6 @@ pub struct BuildNetworkParams<'a, TBl: BlockT, TExPool, TImpQu, TCl> {
|
||||
/// An optional warp sync provider.
|
||||
pub warp_sync: Option<Arc<dyn WarpSyncProvider<TBl>>>,
|
||||
}
|
||||
|
||||
/// Build the network service, the network status sinks and an RPC sender.
|
||||
pub fn build_network<TBl, TExPool, TImpQu, TCl>(
|
||||
params: BuildNetworkParams<TBl, TExPool, TImpQu, TCl>,
|
||||
@@ -857,6 +856,7 @@ where
|
||||
fork_id: config.chain_spec.fork_id().map(ToOwned::to_owned),
|
||||
import_queue: Box::new(import_queue),
|
||||
chain_sync: Box::new(chain_sync),
|
||||
bitswap: config.network.ipfs_server.then(|| Bitswap::from_client(client.clone())),
|
||||
metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()),
|
||||
block_request_protocol_config,
|
||||
state_request_protocol_config,
|
||||
@@ -923,6 +923,11 @@ where
|
||||
pub struct NetworkStarter(oneshot::Sender<()>);
|
||||
|
||||
impl NetworkStarter {
|
||||
/// Create a new NetworkStarter
|
||||
pub fn new(sender: oneshot::Sender<()>) -> Self {
|
||||
NetworkStarter(sender)
|
||||
}
|
||||
|
||||
/// Start the network. Call this after all sub-components have been initialized.
|
||||
///
|
||||
/// > **Note**: If you don't call this function, the networking will not work.
|
||||
|
||||
Reference in New Issue
Block a user