From 1117993a24122f334e2a8c15944cbd0bf3e3b2ca Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Thu, 28 Jan 2021 00:31:29 -0600 Subject: [PATCH] Libp2p connection limits (#2272) * max peers gets set as connection limits * pass max connections --- beacon_chain/eth2_network.nim | 8 +++++++- scripts/launch_local_testnet.sh | 2 +- vendor/nim-libp2p | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index 33400afcd..522eea3b4 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -1526,7 +1526,13 @@ proc newBeaconSwitch*(conf: BeaconNodeConf, seckey: PrivateKey, let identify = newIdentify(peerInfo) - newSwitch(peerInfo, transports, identify, muxers, secureManagers) + newSwitch( + peerInfo, + transports, + identify, + muxers, + secureManagers, + maxConnections = conf.maxPeers) proc createEth2Node*(rng: ref BrHmacDrbgContext, conf: BeaconNodeConf, diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index 51986a51e..9ea1300bc 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -373,7 +373,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do --log-level="${LOG_LEVEL}" \ --tcp-port=$(( BASE_PORT + NUM_NODE )) \ --udp-port=$(( BASE_PORT + NUM_NODE )) \ - --max-peers=$(( NUM_NODES - 1 )) \ + --max-peers=$(( NUM_NODES * 2 - 1 )) \ --data-dir="${NODE_DATA_DIR}" \ ${BOOTSTRAP_ARG} \ ${STATE_SNAPSHOT_ARG} \ diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index 0959877b2..1d77d37f1 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit 0959877b29be802b857cb10ab194f5cf29e3649f +Subproject commit 1d77d37f17a8d4b9bbafb83eae69790dad48b4c5