eth: report error from setupDiscovery at startup

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.
This commit is contained in:
Felix Lange 2025-02-21 16:28:33 +01:00
parent d103f179b9
commit b96220a393
2 changed files with 4 additions and 2 deletions

View file

@ -368,7 +368,9 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
// Start implements node.Lifecycle, starting all internal goroutines needed by the
// Ethereum protocol implementation.
func (s *Ethereum) Start() error {
s.setupDiscovery()
if err := s.setupDiscovery(); err != nil {
return err
}
// Start the bloom bits servicing goroutines
s.startBloomHandlers(params.BloomBitsBlocks)

View file

@ -263,7 +263,7 @@ func (it *randomIterator) Next() bool {
func (it *randomIterator) addTree(url string) error {
le, err := parseLink(url)
if err != nil {
return fmt.Errorf("invalid enrtree URL: %v", err)
return fmt.Errorf("invalid DNS discovery URL %q: %v", url, err)
}
it.lc.addLink("", le.str)
return nil