Skip to content

Commit 039882c

Browse files
Fix chan usage
1 parent 3202720 commit 039882c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

l1/l1.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ func (c *Client) makeSubscriptionToStateUpdates(ctx context.Context, buffer int)
228228
}
229229

230230
func (c *Client) makeSubscribtionsToIPAddresses(ctx context.Context, buffer int) error {
231+
defer close(c.eventsToP2P)
231232
addresses, err := c.l1.GetIPAddresses(ctx, *c.network.IPAddressRegistry)
232233
if err != nil {
233234
return err

node/node.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ import (
3939
)
4040

4141
const (
42-
upgraderDelay = 5 * time.Minute
43-
githubAPIUrl = "https://api.github.com/repos/NethermindEth/juno/releases/latest"
44-
latestReleaseURL = "https://github.com/NethermindEth/juno/releases/latest"
45-
l1ToP2PChannelBuffer = 128
42+
upgraderDelay * time.Minute
43+
githubAPIUrl = "https://api.github.com/repos/NethermindEth/juno/releases/latest"
44+
latestReleaseURLhttps://github.com/NethermindEth/juno/releases/latest"
4645
)
4746

4847
// Config is the top-level juno configuration.
@@ -182,8 +181,7 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen
182181
rpcHandler = rpcHandler.WithFilterLimit(cfg.RPCMaxBlockScan).WithCallMaxSteps(uint64(cfg.RPCCallMaxSteps))
183182
services = append(services, rpcHandler)
184183

185-
l1ToP2P := make(chan p2p.IPAddressRegistryEvent, l1ToP2PChannelBuffer) //nolin:mnd
186-
184+
l1ToP2P := make(chan p2p.IPAddressRegistryEvent)
187185
if !cfg.DisableL1Verification {
188186
// Due to mutually exclusive flag we can do the following.
189187
if cfg.EthNode == "" {
@@ -197,6 +195,8 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen
197195
}
198196
services = append(services, l1Client)
199197
rpcHandler.WithL1Client(l1Client.L1())
198+
} else {
199+
close(l1ToP2P)
200200
}
201201

202202
var p2pService *p2p.Service

0 commit comments

Comments
 (0)