Skip to content

Commit

Permalink
Caplin: use sentinel default UDP address 0.0.0.0 (#13483)
Browse files Browse the repository at this point in the history
Caplin's sentinel opens UDP port controlled by flag
`--caplin.discovery.port` we open it at `0.0.0.0` ignoring another flag
`--caplin.discovery.addr` which is `127.0.0.1`. TCP port opened
correctly with respect of `.addr`.

PR fixes default behavior.
  • Loading branch information
awskii authored Jan 25, 2025
1 parent 2700d76 commit d49eff0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions cl/sentinel/sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,11 @@ func (s *Sentinel) createListener() (*discover.UDPv5, error) {

var bindIP net.IP
var networkVersion string

// If the IP is an IPv4 address, bind to the correct zero address.
if ip.To4() != nil {
bindIP = net.IPv4zero
networkVersion = "udp4"
bindIP, networkVersion = ip.To4(), "udp4"
} else {
bindIP = net.IPv6zero
networkVersion = "udp6"
bindIP, networkVersion = ip.To16(), "udp6"
}

udpAddr := &net.UDPAddr{
Expand All @@ -179,11 +176,11 @@ func (s *Sentinel) createListener() (*discover.UDPv5, error) {
}

// Start stream handlers

net, err := discover.ListenV5(s.ctx, "any", conn, localNode, discCfg)
if err != nil {
return nil, err
}

handlers.NewConsensusHandlers(s.ctx, s.blockReader, s.indiciesDB, s.host, s.peers, s.cfg.NetworkConfig, localNode, s.cfg.BeaconConfig, s.ethClock, s.handshaker, s.forkChoiceReader, s.blobStorage, s.cfg.EnableBlocks).Start()

return net, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ var (
CaplinDiscoveryAddrFlag = cli.StringFlag{
Name: "caplin.discovery.addr",
Usage: "Address for Caplin DISCV5 protocol",
Value: "127.0.0.1",
Value: "0.0.0.0",
}
CaplinDiscoveryPortFlag = cli.Uint64Flag{
Name: "caplin.discovery.port",
Expand Down

0 comments on commit d49eff0

Please sign in to comment.