diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 56880768f9c2..051bdd630841 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1584,7 +1584,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { if ctx.GlobalIsSet(RPCGlobalTxFeeCapFlag.Name) { cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCapFlag.Name) } - if ctx.GlobalIsSet(DNSDiscoveryFlag.Name) { + if ctx.GlobalIsSet(NoDiscoverFlag.Name) { + cfg.DiscoveryURLs = []string{} + } else if ctx.GlobalIsSet(DNSDiscoveryFlag.Name) { urls := ctx.GlobalString(DNSDiscoveryFlag.Name) if urls == "" { cfg.DiscoveryURLs = []string{} diff --git a/eth/backend.go b/eth/backend.go index 01e6cadd1f6c..03b0b319b76c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -208,7 +208,7 @@ func New(stack *node.Node, config *Config) (*Ethereum, error) { } eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams) - eth.dialCandidates, err = eth.setupDiscovery(&stack.Config().P2P) + eth.dialCandidates, err = eth.setupDiscovery() if err != nil { return nil, err } diff --git a/eth/discovery.go b/eth/discovery.go index 48f6159017cc..e7a281d35635 100644 --- a/eth/discovery.go +++ b/eth/discovery.go @@ -19,7 +19,6 @@ package eth import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/dnsdisc" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/rlp" @@ -65,8 +64,8 @@ func (eth *Ethereum) currentEthEntry() *ethEntry { } // setupDiscovery creates the node discovery source for the eth protocol. -func (eth *Ethereum) setupDiscovery(cfg *p2p.Config) (enode.Iterator, error) { - if cfg.NoDiscovery || len(eth.config.DiscoveryURLs) == 0 { +func (eth *Ethereum) setupDiscovery() (enode.Iterator, error) { + if len(eth.config.DiscoveryURLs) == 0 { return nil, nil } client := dnsdisc.NewClient(dnsdisc.Config{}) diff --git a/les/client.go b/les/client.go index a2f7c56dfd57..37250d076fde 100644 --- a/les/client.go +++ b/les/client.go @@ -112,7 +112,7 @@ func New(stack *node.Node, config *eth.Config) (*LightEthereum, error) { } peers.subscribe((*vtSubscription)(leth.valueTracker)) - dnsdisc, err := leth.setupDiscovery(&stack.Config().P2P) + dnsdisc, err := leth.setupDiscovery() if err != nil { return nil, err } diff --git a/les/enr_entry.go b/les/enr_entry.go index 11e6273be532..8f0169bee1cf 100644 --- a/les/enr_entry.go +++ b/les/enr_entry.go @@ -17,7 +17,6 @@ package les import ( - "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/dnsdisc" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/rlp" @@ -35,8 +34,8 @@ func (e lesEntry) ENRKey() string { } // setupDiscovery creates the node discovery source for the eth protocol. -func (eth *LightEthereum) setupDiscovery(cfg *p2p.Config) (enode.Iterator, error) { - if cfg.NoDiscovery || len(eth.config.DiscoveryURLs) == 0 { +func (eth *LightEthereum) setupDiscovery() (enode.Iterator, error) { + if len(eth.config.DiscoveryURLs) == 0 { return nil, nil } client := dnsdisc.NewClient(dnsdisc.Config{})