Skip to content

Commit

Permalink
cmd/utils,p2p: enable discv5 by default (#30327)
Browse files Browse the repository at this point in the history
  • Loading branch information
lightclient committed Aug 20, 2024
1 parent 3c37db7 commit 00294e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,9 @@ var (
DiscoveryV5Flag = &cli.BoolFlag{
Name: "discovery.v5",
Aliases: []string{"discv5"},
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
Usage: "Enables the V5 discovery mechanism",
Category: flags.NetworkingCategory,
Value: true,
}
NetrestrictFlag = &cli.StringFlag{
Name: "netrestrict",
Expand Down
5 changes: 3 additions & 2 deletions p2p/discover/v4_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ func (t *UDPv4) readLoop(unhandled chan<- ReadPacket) {
}
return
}
if t.handlePacket(from, buf[:nbytes]) != nil && unhandled != nil {
if err := t.handlePacket(from, buf[:nbytes]); err != nil && unhandled == nil {
t.log.Debug("Bad discv4 packet", "addr", from, "err", err)
} else if err != nil && unhandled != nil {
select {
case unhandled <- ReadPacket{buf[:nbytes], from}:
default:
Expand All @@ -564,7 +566,6 @@ func (t *UDPv4) handlePacket(from netip.AddrPort, buf []byte) error {

rawpacket, fromKey, hash, err := v4wire.Decode(buf)
if err != nil {
t.log.Debug("Bad discv4 packet", "addr", from, "err", err)
return err
}
packet := t.wrapPacket(rawpacket)
Expand Down

0 comments on commit 00294e9

Please sign in to comment.