mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Move block announcement protocol config out of Protocol (#12441)
* Move Role(s) to `sc-network-common` * Introduce `NotificationHandshake` type * Move block announce protocol config creation to `ChainSync` * Include block announcement into `notification_protocols` * Apply review comments * Remove unneeded include * Add missing include * Apply review comments
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
pub use sc_network_common::{
|
||||
config::ProtocolId,
|
||||
protocol::role::Role,
|
||||
request_responses::{
|
||||
IncomingRequest, OutgoingResponse, ProtocolConfig as RequestResponseConfig,
|
||||
},
|
||||
@@ -93,6 +94,9 @@ where
|
||||
/// Registry for recording prometheus metrics to.
|
||||
pub metrics_registry: Option<Registry>,
|
||||
|
||||
/// Block announce protocol configuration
|
||||
pub block_announce_config: NonDefaultSetConfig,
|
||||
|
||||
/// Request response configuration for the block request protocol.
|
||||
///
|
||||
/// [`RequestResponseConfig::name`] is used to tag outgoing block requests with the correct
|
||||
@@ -130,31 +134,6 @@ where
|
||||
pub request_response_protocol_configs: Vec<RequestResponseConfig>,
|
||||
}
|
||||
|
||||
/// Role of the local node.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Role {
|
||||
/// Regular full node.
|
||||
Full,
|
||||
/// Actual authority.
|
||||
Authority,
|
||||
}
|
||||
|
||||
impl Role {
|
||||
/// True for [`Role::Authority`].
|
||||
pub fn is_authority(&self) -> bool {
|
||||
matches!(self, Self::Authority { .. })
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Role {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Full => write!(f, "FULL"),
|
||||
Self::Authority { .. } => write!(f, "AUTHORITY"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Sync operation mode.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum SyncMode {
|
||||
|
||||
Reference in New Issue
Block a user