mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +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:
@@ -68,11 +68,12 @@ pub use self::{
|
||||
};
|
||||
|
||||
use libp2p::{multiaddr, PeerId};
|
||||
use sc_network_common::service::{
|
||||
NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
|
||||
use sc_network_common::{
|
||||
protocol::ProtocolName,
|
||||
service::{NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers},
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, NumberFor};
|
||||
use std::{borrow::Cow, iter};
|
||||
use std::iter;
|
||||
|
||||
mod bridge;
|
||||
mod state_machine;
|
||||
@@ -82,7 +83,7 @@ mod validator;
|
||||
pub trait Network<B: BlockT>:
|
||||
NetworkPeers + NetworkEventStream + NetworkNotification + NetworkBlock<B::Hash, NumberFor<B>>
|
||||
{
|
||||
fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>) {
|
||||
fn add_set_reserved(&self, who: PeerId, protocol: ProtocolName) {
|
||||
let addr =
|
||||
iter::once(multiaddr::Protocol::P2p(who.into())).collect::<multiaddr::Multiaddr>();
|
||||
let result = self.add_peers_to_reserved_set(protocol, iter::once(addr).collect());
|
||||
|
||||
Reference in New Issue
Block a user