From 039882c9c3b36cce3d57452aa9684def4b707630 Mon Sep 17 00:00:00 2001 From: AnkushinDaniil Date: Wed, 18 Dec 2024 16:57:33 +0700 Subject: [PATCH] Fix chan usage --- l1/l1.go | 1 + node/node.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/l1/l1.go b/l1/l1.go index 75679da76d..8da096dd07 100644 --- a/l1/l1.go +++ b/l1/l1.go @@ -228,6 +228,7 @@ func (c *Client) makeSubscriptionToStateUpdates(ctx context.Context, buffer int) } func (c *Client) makeSubscribtionsToIPAddresses(ctx context.Context, buffer int) error { + defer close(c.eventsToP2P) addresses, err := c.l1.GetIPAddresses(ctx, *c.network.IPAddressRegistry) if err != nil { return err diff --git a/node/node.go b/node/node.go index 963d3faae1..5279d98d56 100644 --- a/node/node.go +++ b/node/node.go @@ -39,10 +39,9 @@ import ( ) const ( - upgraderDelay = 5 * time.Minute - githubAPIUrl = "https://api.github.com/repos/NethermindEth/juno/releases/latest" - latestReleaseURL = "https://github.com/NethermindEth/juno/releases/latest" - l1ToP2PChannelBuffer = 128 + upgraderDelay * time.Minute + githubAPIUrl = "https://api.github.com/repos/NethermindEth/juno/releases/latest" + latestReleaseURLhttps://github.com/NethermindEth/juno/releases/latest" ) // Config is the top-level juno configuration. @@ -182,8 +181,7 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen rpcHandler = rpcHandler.WithFilterLimit(cfg.RPCMaxBlockScan).WithCallMaxSteps(uint64(cfg.RPCCallMaxSteps)) services = append(services, rpcHandler) - l1ToP2P := make(chan p2p.IPAddressRegistryEvent, l1ToP2PChannelBuffer) //nolin:mnd - + l1ToP2P := make(chan p2p.IPAddressRegistryEvent) if !cfg.DisableL1Verification { // Due to mutually exclusive flag we can do the following. if cfg.EthNode == "" { @@ -197,6 +195,8 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen } services = append(services, l1Client) rpcHandler.WithL1Client(l1Client.L1()) + } else { + close(l1ToP2P) } var p2pService *p2p.Service