Remove backwards-compatibility networking hack (#8068)

* Remove backwards-compatibility networking hack

* Fix compilation

* Try fix
This commit is contained in:
Pierre Krieger
2021-02-08 14:44:34 +01:00
committed by GitHub
parent 884d916559
commit 1eeafdd2b3
2 changed files with 9 additions and 10 deletions
+3 -3
View File
@@ -676,10 +676,10 @@ pub fn grandpa_peers_set_config() -> sc_network::config::NonDefaultSetConfig {
// Notifications reach ~256kiB in size at the time of writing on Kusama and Polkadot. // Notifications reach ~256kiB in size at the time of writing on Kusama and Polkadot.
max_notification_size: 1024 * 1024, max_notification_size: 1024 * 1024,
set_config: sc_network::config::SetConfig { set_config: sc_network::config::SetConfig {
in_peers: 25, in_peers: 0,
out_peers: 25, out_peers: 0,
reserved_nodes: Vec::new(), reserved_nodes: Vec::new(),
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept, non_reserved_mode: sc_network::config::NonReservedPeerMode::Deny,
}, },
} }
} }
+6 -7
View File
@@ -424,12 +424,11 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
// The `reserved_nodes` of this set are later kept in sync with the peers we connect // The `reserved_nodes` of this set are later kept in sync with the peers we connect
// to through set 0. // to through set 0.
sets.push(sc_peerset::SetConfig { sets.push(sc_peerset::SetConfig {
in_peers: network_config.default_peers_set.in_peers, in_peers: 0,
out_peers: network_config.default_peers_set.out_peers, out_peers: 0,
bootnodes: Vec::new(), bootnodes: Vec::new(),
reserved_nodes: default_sets_reserved, reserved_nodes: HashSet::new(),
reserved_only: network_config.default_peers_set.non_reserved_mode reserved_only: true,
== config::NonReservedPeerMode::Deny,
}); });
for set_cfg in &network_config.extra_sets { for set_cfg in &network_config.extra_sets {
@@ -1698,7 +1697,7 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
if self.on_sync_peer_connected(peer_id.clone(), handshake).is_ok() { if self.on_sync_peer_connected(peer_id.clone(), handshake).is_ok() {
// Set 1 is kept in sync with the connected peers of set 0. // Set 1 is kept in sync with the connected peers of set 0.
self.peerset_handle.add_to_peers_set( self.peerset_handle.add_reserved_peer(
HARDCODED_PEERSETS_TX, HARDCODED_PEERSETS_TX,
peer_id.clone() peer_id.clone()
); );
@@ -1722,7 +1721,7 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
Ok(handshake) => { Ok(handshake) => {
if self.on_sync_peer_connected(peer_id.clone(), handshake).is_ok() { if self.on_sync_peer_connected(peer_id.clone(), handshake).is_ok() {
// Set 1 is kept in sync with the connected peers of set 0. // Set 1 is kept in sync with the connected peers of set 0.
self.peerset_handle.add_to_peers_set( self.peerset_handle.add_reserved_peer(
HARDCODED_PEERSETS_TX, HARDCODED_PEERSETS_TX,
peer_id.clone() peer_id.clone()
); );