Skip to content

Commit

Permalink
Remove backwards-compatibility networking hack (paritytech#8068)
Browse files Browse the repository at this point in the history
* Remove backwards-compatibility networking hack

* Fix compilation

* Try fix
  • Loading branch information
tomaka authored Feb 8, 2021
1 parent bbc7b0e commit 29aca98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions client/finality-grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
max_notification_size: 1024 * 1024,
set_config: sc_network::config::SetConfig {
in_peers: 25,
out_peers: 25,
in_peers: 0,
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
non_reserved_mode: sc_network::config::NonReservedPeerMode::Deny,
},
}
}
Expand Down
13 changes: 6 additions & 7 deletions client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// to through set 0.
sets.push(sc_peerset::SetConfig {
in_peers: network_config.default_peers_set.in_peers,
out_peers: network_config.default_peers_set.out_peers,
in_peers: 0,
out_peers: 0,
bootnodes: Vec::new(),
reserved_nodes: default_sets_reserved,
reserved_only: network_config.default_peers_set.non_reserved_mode
== config::NonReservedPeerMode::Deny,
reserved_nodes: HashSet::new(),
reserved_only: true,
});

for set_cfg in &network_config.extra_sets {
Expand Down Expand Up @@ -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() {
// 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,
peer_id.clone()
);
Expand All @@ -1722,7 +1721,7 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
Ok(handshake) => {
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.
self.peerset_handle.add_to_peers_set(
self.peerset_handle.add_reserved_peer(
HARDCODED_PEERSETS_TX,
peer_id.clone()
);
Expand Down

0 comments on commit 29aca98

Please sign in to comment.