mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 01:38:04 +00:00
The network configuration now makes more sense (#2706)
* The network configuration now makes more sense * Reexport ProtocolConfig
This commit is contained in:
committed by
Gavin Wood
parent
3a0c52f2b1
commit
f8303a6b57
@@ -16,9 +16,11 @@
|
||||
|
||||
//! Configuration for the networking layer of Substrate.
|
||||
|
||||
pub use network_libp2p::{NonReservedPeerMode, NetworkConfiguration, NodeKeyConfig, Secret};
|
||||
pub use crate::protocol::ProtocolConfig;
|
||||
pub use network_libp2p::{NonReservedPeerMode, NetworkConfiguration, NodeKeyConfig, ProtocolId, Secret};
|
||||
|
||||
use bitflags::bitflags;
|
||||
use consensus::import_queue::ImportQueue;
|
||||
use crate::chain::{Client, FinalityProofProvider};
|
||||
use parity_codec;
|
||||
use crate::on_demand_layer::OnDemand;
|
||||
@@ -28,8 +30,8 @@ use std::sync::Arc;
|
||||
|
||||
/// Service initialization parameters.
|
||||
pub struct Params<B: BlockT, S, H: ExHashT> {
|
||||
/// Configuration.
|
||||
pub config: ProtocolConfig,
|
||||
/// Assigned roles for our node.
|
||||
pub roles: Roles,
|
||||
/// Network layer configuration.
|
||||
pub network_config: NetworkConfiguration,
|
||||
/// Substrate relay chain access point.
|
||||
@@ -40,25 +42,14 @@ pub struct Params<B: BlockT, S, H: ExHashT> {
|
||||
pub on_demand: Option<Arc<OnDemand<B>>>,
|
||||
/// Transaction pool.
|
||||
pub transaction_pool: Arc<dyn TransactionPool<H, B>>,
|
||||
/// Name of the protocol to use on the wire. Should be different for each chain.
|
||||
pub protocol_id: ProtocolId,
|
||||
/// Import queue to use.
|
||||
pub import_queue: Box<ImportQueue<B>>,
|
||||
/// Protocol specialization.
|
||||
pub specialization: S,
|
||||
}
|
||||
|
||||
/// Configuration for the Substrate-specific part of the networking layer.
|
||||
#[derive(Clone)]
|
||||
pub struct ProtocolConfig {
|
||||
/// Assigned roles.
|
||||
pub roles: Roles,
|
||||
}
|
||||
|
||||
impl Default for ProtocolConfig {
|
||||
fn default() -> ProtocolConfig {
|
||||
ProtocolConfig {
|
||||
roles: Roles::FULL,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
/// Bitmask of the roles that a node fulfills.
|
||||
pub struct Roles: u8 {
|
||||
|
||||
Reference in New Issue
Block a user