Skip to content

Commit 7fd951f

Browse files
fjlMariusVanDerWijden
authored andcommitted
eth: report error from setupDiscovery at startup (ethereum#31233)
I ran into this while trying to debug a discv5 thing. I tried to disable DNS discovery using `--discovery.dns=false`, which doesn't work. Annoyingly, geth started anyway and discarded the error silently. I eventually found my mistake, but it took way longer than it should have. Also including a small change to the error message for invalid DNS URLs here. The user actually needs to see the URL to make sense of the error.
1 parent e11ddf0 commit 7fd951f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: eth/backend.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
368368
// Start implements node.Lifecycle, starting all internal goroutines needed by the
369369
// Ethereum protocol implementation.
370370
func (s *Ethereum) Start() error {
371-
s.setupDiscovery()
371+
if err := s.setupDiscovery(); err != nil {
372+
return err
373+
}
372374

373375
// Start the bloom bits servicing goroutines
374376
s.startBloomHandlers(params.BloomBitsBlocks)

Diff for: p2p/dnsdisc/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (it *randomIterator) Next() bool {
263263
func (it *randomIterator) addTree(url string) error {
264264
le, err := parseLink(url)
265265
if err != nil {
266-
return fmt.Errorf("invalid enrtree URL: %v", err)
266+
return fmt.Errorf("invalid DNS discovery URL %q: %v", url, err)
267267
}
268268
it.lc.addLink("", le.str)
269269
return nil

0 commit comments

Comments
 (0)