mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 17:57:56 +00:00
Use custom type for ProtocolName (#12172)
* Add ProtocolName custom type * Use new ProtocolName in sc_network_common * Use new ProtocolName in sc_network * Use new ProtocolName for BEEFY and GRANDPA * Use new ProtocolName for notifications * Use new ProtocolName in sc_network (part 2) * Use new ProtocolName in sc_network_gossip * Use new ProtocolName in sc_offchain * Remove unused imports * Some more fixes * Add tests * Fix minor import issues * Re-export ProtocolName in sc_network * Revert "Re-export ProtocolName in sc_network" This reverts commit 8d8ff71927e7750757f29c9bbd88dc0ba181d214. * Re-export ProtocolName in sc_network * Remove dependency on sc-network-common from beefy-gadget
This commit is contained in:
@@ -33,15 +33,14 @@ use libp2p::{
|
||||
use log::{error, trace, warn};
|
||||
use parking_lot::RwLock;
|
||||
use rand::distributions::{Distribution as _, Uniform};
|
||||
use sc_network_common::protocol::ProtocolName;
|
||||
use sc_peerset::DropReason;
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cmp,
|
||||
collections::{hash_map::Entry, VecDeque},
|
||||
mem,
|
||||
pin::Pin,
|
||||
str,
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
time::{Duration, Instant},
|
||||
@@ -140,9 +139,9 @@ pub struct Notifications {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ProtocolConfig {
|
||||
/// Name of the protocol.
|
||||
pub name: Cow<'static, str>,
|
||||
pub name: ProtocolName,
|
||||
/// Names of the protocol to use if the main one isn't available.
|
||||
pub fallback_names: Vec<Cow<'static, str>>,
|
||||
pub fallback_names: Vec<ProtocolName>,
|
||||
/// Handshake of the protocol.
|
||||
pub handshake: Vec<u8>,
|
||||
/// Maximum allowed size for a notification.
|
||||
@@ -309,7 +308,7 @@ pub enum NotificationsOut {
|
||||
set_id: sc_peerset::SetId,
|
||||
/// If `Some`, a fallback protocol name has been used rather the main protocol name.
|
||||
/// Always matches one of the fallback names passed at initialization.
|
||||
negotiated_fallback: Option<Cow<'static, str>>,
|
||||
negotiated_fallback: Option<ProtocolName>,
|
||||
/// Handshake that was sent to us.
|
||||
/// This is normally a "Status" message, but this is out of the concern of this code.
|
||||
received_handshake: Vec<u8>,
|
||||
|
||||
Reference in New Issue
Block a user