Companion for paritytech/substrate#13592 (#6869)

* Move configs

* Start using `NetworkService` traits from `sc-network`

* Fix stuff

* Remove `sc-network-common` as dependency

* update lockfile for {"substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Aaro Altonen
2023-03-14 14:52:15 +02:00
committed by GitHub
parent 5565bb9dbc
commit 0e1c932c42
9 changed files with 212 additions and 212 deletions
@@ -18,9 +18,9 @@
use derive_more::Display;
use polkadot_primitives::Hash;
use sc_network_common::{
use sc_network::{
config::{NonDefaultSetConfig, SetConfig},
protocol::ProtocolName,
types::ProtocolName,
};
use std::{
collections::{hash_map::Entry, HashMap},
@@ -81,7 +81,7 @@ impl PeerSet {
fallback_names,
max_notification_size,
handshake: None,
set_config: sc_network_common::config::SetConfig {
set_config: SetConfig {
// we allow full nodes to connect to validators for gossip
// to ensure any `MIN_GOSSIP_PEERS` always include reserved peers
// we limit the amount of non-reserved slots to be less
@@ -89,7 +89,7 @@ impl PeerSet {
in_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
out_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
reserved_nodes: Vec::new(),
non_reserved_mode: sc_network_common::config::NonReservedPeerMode::Accept,
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
},
},
PeerSet::Collation => NonDefaultSetConfig {
@@ -103,9 +103,9 @@ impl PeerSet {
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: if is_authority == IsAuthority::Yes {
sc_network_common::config::NonReservedPeerMode::Accept
sc_network::config::NonReservedPeerMode::Accept
} else {
sc_network_common::config::NonReservedPeerMode::Deny
sc_network::config::NonReservedPeerMode::Deny
},
},
},
@@ -190,7 +190,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
pub fn peer_sets_info(
is_authority: IsAuthority,
peerset_protocol_names: &PeerSetProtocolNames,
) -> Vec<sc_network_common::config::NonDefaultSetConfig> {
) -> Vec<NonDefaultSetConfig> {
PeerSet::iter()
.map(|s| s.get_info(is_authority, &peerset_protocol_names))
.collect()