From a29edf4764837bf690119ff150ac9a613c60142b Mon Sep 17 00:00:00 2001 From: Tuyen Nguyen Date: Sun, 15 Jan 2023 05:43:51 +0700 Subject: [PATCH] Set maxConnections in libp2p's connection manager --- packages/beacon-node/src/network/nodejs/bundle.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/beacon-node/src/network/nodejs/bundle.ts b/packages/beacon-node/src/network/nodejs/bundle.ts index f226c99f784..3b7abdd97dd 100644 --- a/packages/beacon-node/src/network/nodejs/bundle.ts +++ b/packages/beacon-node/src/network/nodejs/bundle.ts @@ -66,8 +66,11 @@ export async function createNodejsLibp2p(options: ILibp2pOptions): Promise maxConnections calls _maybeDisconnectOne() which will sort peers disconnect + // the one with the least `_peerValues`. That's a custom peer generalized score that's not used, so it always + // has the same value in current Lodestar usage. + maxConnections: options.maxConnections, // DOCS: the minimum number of connections below which libp2p not activate preemptive disconnections. // If ConnectionManager.size < minConnections, it won't prune peers in _maybeDisconnectOne(). If autoDial is // off it doesn't have any effect in behaviour.