cmd/geth: enable DNS discovery by default (#20660)
* node: expose config in service context * eth: integrate p2p/dnsdisc * cmd/geth: add some DNS flags * eth: remove DNS URLs * cmd/utils: configure DNS names for testnets * params: update DNS URLs * cmd/geth: configure mainnet DNS * cmd/utils: rename DNS flag and fix flag processing * cmd/utils: remove debug print * node: fix test
This commit is contained in:
@ -47,6 +47,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/miner"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
@ -74,6 +75,7 @@ type Ethereum struct {
|
||||
blockchain *core.BlockChain
|
||||
protocolManager *ProtocolManager
|
||||
lesServer LesServer
|
||||
dialCandiates enode.Iterator
|
||||
|
||||
// DB interfaces
|
||||
chainDb ethdb.Database // Block chain database
|
||||
@ -220,6 +222,11 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
||||
}
|
||||
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
|
||||
|
||||
eth.dialCandiates, err = eth.setupDiscovery(&ctx.Config.P2P)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return eth, nil
|
||||
}
|
||||
|
||||
@ -510,6 +517,7 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
|
||||
for i, vsn := range ProtocolVersions {
|
||||
protos[i] = s.protocolManager.makeProtocol(vsn)
|
||||
protos[i].Attributes = []enr.Entry{s.currentEthEntry()}
|
||||
protos[i].DialCandidates = s.dialCandiates
|
||||
}
|
||||
if s.lesServer != nil {
|
||||
protos = append(protos, s.lesServer.Protocols()...)
|
||||
|
Reference in New Issue
Block a user