Skip to content

Commit

Permalink
Merge of #6993
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 19, 2023
2 parents dd7a1ac + 85fda39 commit 25a636c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion zebra-network/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub const OUTBOUND_PEER_LIMIT_MULTIPLIER: usize = 3;

/// The maximum number of peer connections Zebra will keep for a given IP address
/// before it drops any additional peer connections with that IP.
pub const MAX_CONNS_PER_IP: usize = 3;
pub const MAX_CONNS_PER_IP: usize = 1;

/// The buffer size for the peer set.
///
Expand Down
7 changes: 6 additions & 1 deletion zebra-network/src/peer_set/set/tests/vectors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Fixed test vectors for the peer set.

use std::{iter, time::Duration};
use std::{cmp::max, iter, time::Duration};

use tokio::time::timeout;
use tower::{Service, ServiceExt};
Expand All @@ -12,6 +12,7 @@ use zebra_chain::{

use super::{PeerSetBuilder, PeerVersions};
use crate::{
constants::MAX_CONNS_PER_IP,
peer::{ClientRequest, MinimumPeerVersion},
peer_set::inventory_registry::InventoryStatus,
protocol::external::{types::Version, InventoryHash},
Expand Down Expand Up @@ -144,6 +145,7 @@ fn peer_set_ready_multiple_connections() {
let (mut peer_set, _peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(3, MAX_CONNS_PER_IP))
.build();

// Get peerset ready
Expand Down Expand Up @@ -257,6 +259,7 @@ fn peer_set_route_inv_empty_registry() {
let (mut peer_set, _peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Get peerset ready
Expand Down Expand Up @@ -339,6 +342,7 @@ fn peer_set_route_inv_advertised_registry_order(advertised_first: bool) {
let (mut peer_set, mut peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Advertise some inventory
Expand Down Expand Up @@ -446,6 +450,7 @@ fn peer_set_route_inv_missing_registry_order(missing_first: bool) {
let (mut peer_set, mut peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Mark some inventory as missing
Expand Down

0 comments on commit 25a636c

Please sign in to comment.