From 9144fdc5326b5e3ab6d2a2d3ef1f815dd346eb13 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Fri, 13 Oct 2023 11:24:45 +0200 Subject: [PATCH] Revert some code change --- .../src/network/core/networkCore.ts | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/packages/beacon-node/src/network/core/networkCore.ts b/packages/beacon-node/src/network/core/networkCore.ts index d7500f50c75a..f0757c624bbb 100644 --- a/packages/beacon-node/src/network/core/networkCore.ts +++ b/packages/beacon-node/src/network/core/networkCore.ts @@ -253,28 +253,24 @@ export class NetworkCore implements INetworkCore { /** Destroy this instance. Can only be called once. */ async close(): Promise { if (this.closed) return; - try { - this.clock.off(ClockEvent.epoch, this.onEpoch); - - // Must goodbye and disconnect before stopping libp2p - await this.peerManager.goodbyeAndDisconnectAllPeers(); - this.logger.debug("network sent goodbye to all peers"); - await this.peerManager.close(); - this.logger.debug("network peerManager closed"); - await this.gossip.stop(); - this.logger.debug("network gossip closed"); - await this.reqResp.stop(); - await this.reqResp.unregisterAllProtocols(); - this.logger.debug("network reqResp closed"); - this.attnetsService.close(); - this.syncnetsService.close(); - await this.libp2p.stop(); - this.logger.debug("network lib2p closed"); - - this.closed = true; - } catch (err) { - this.logger.error("Error on NetworkCore.close()", {}, err as Error); - } + this.clock.off(ClockEvent.epoch, this.onEpoch); + + // Must goodbye and disconnect before stopping libp2p + await this.peerManager.goodbyeAndDisconnectAllPeers(); + this.logger.debug("network sent goodbye to all peers"); + await this.peerManager.close(); + this.logger.debug("network peerManager closed"); + await this.gossip.stop(); + this.logger.debug("network gossip closed"); + await this.reqResp.stop(); + await this.reqResp.unregisterAllProtocols(); + this.logger.debug("network reqResp closed"); + this.attnetsService.close(); + this.syncnetsService.close(); + await this.libp2p.stop(); + this.logger.debug("network lib2p closed"); + + this.closed = true; } async scrapeMetrics(): Promise {