Skip to content

Commit

Permalink
Fix chan usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil committed Dec 24, 2024
1 parent 3202720 commit 039882c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions l1/l1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 == "" {
Expand All @@ -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
Expand Down

0 comments on commit 039882c

Please sign in to comment.