p2p, cmd/utils: remove DiscoveryV5Addr

This commit is contained in:
Zsolt Felfoldi 2017-09-25 16:19:15 +02:00
parent c9a1981292
commit 9a61c871a4
6 changed files with 4 additions and 20 deletions

View file

@ -223,7 +223,6 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
NoDiscovery: true, NoDiscovery: true,
DiscoveryV5: true, DiscoveryV5: true,
ListenAddr: fmt.Sprintf(":%d", port), ListenAddr: fmt.Sprintf(":%d", port),
DiscoveryV5Addr: fmt.Sprintf(":%d", port+1),
MaxPeers: 25, MaxPeers: 25,
BootstrapNodesV5: enodes, BootstrapNodesV5: enodes,
}, },

View file

@ -635,14 +635,6 @@ func setListenAddress(ctx *cli.Context, cfg *p2p.Config) {
} }
} }
// setDiscoveryV5Address creates a UDP listening address string from set command
// line flags for the V5 discovery protocol.
func setDiscoveryV5Address(ctx *cli.Context, cfg *p2p.Config) {
if ctx.GlobalIsSet(ListenPortFlag.Name) {
cfg.DiscoveryV5Addr = fmt.Sprintf(":%d", ctx.GlobalInt(ListenPortFlag.Name)+1)
}
}
// setNAT creates a port mapper from command line flags. // setNAT creates a port mapper from command line flags.
func setNAT(ctx *cli.Context, cfg *p2p.Config) { func setNAT(ctx *cli.Context, cfg *p2p.Config) {
if ctx.GlobalIsSet(NATFlag.Name) { if ctx.GlobalIsSet(NATFlag.Name) {
@ -793,7 +785,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
setNodeKey(ctx, cfg) setNodeKey(ctx, cfg)
setNAT(ctx, cfg) setNAT(ctx, cfg)
setListenAddress(ctx, cfg) setListenAddress(ctx, cfg)
setDiscoveryV5Address(ctx, cfg)
setBootstrapNodes(ctx, cfg) setBootstrapNodes(ctx, cfg)
setBootstrapNodesV5(ctx, cfg) setBootstrapNodesV5(ctx, cfg)
@ -829,7 +820,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
// --dev mode can't use p2p networking. // --dev mode can't use p2p networking.
cfg.MaxPeers = 0 cfg.MaxPeers = 0
cfg.ListenAddr = ":0" cfg.ListenAddr = ":0"
cfg.DiscoveryV5Addr = ":0"
cfg.NoDiscovery = true cfg.NoDiscovery = true
cfg.DiscoveryV5 = false cfg.DiscoveryV5 = false
} }

View file

@ -116,7 +116,6 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
P2P: p2p.Config{ P2P: p2p.Config{
NoDiscovery: true, NoDiscovery: true,
DiscoveryV5: true, DiscoveryV5: true,
DiscoveryV5Addr: ":0",
BootstrapNodesV5: config.BootstrapNodes.nodes, BootstrapNodesV5: config.BootstrapNodes.nodes,
ListenAddr: ":0", ListenAddr: ":0",
NAT: nat.Any(), NAT: nat.Any(),

View file

@ -42,7 +42,6 @@ var DefaultConfig = Config{
WSModules: []string{"net", "web3"}, WSModules: []string{"net", "web3"},
P2P: p2p.Config{ P2P: p2p.Config{
ListenAddr: ":30303", ListenAddr: ":30303",
DiscoveryV5Addr: ":30304",
MaxPeers: 25, MaxPeers: 25,
NAT: nat.Any(), NAT: nat.Any(),
}, },

View file

@ -643,7 +643,7 @@ func (s *ticketStore) gotTopicNodes(from *Node, hash common.Hash, nodes []rpcNod
if ip.IsUnspecified() || ip.IsLoopback() { if ip.IsUnspecified() || ip.IsLoopback() {
ip = from.IP ip = from.IP
} }
n := NewNode(node.ID, ip, node.UDP-1, node.TCP-1) // subtract one from port while discv5 is running in test mode on UDPport+1 n := NewNode(node.ID, ip, node.UDP, node.TCP)
select { select {
case chn <- n: case chn <- n:
default: default:

View file

@ -78,9 +78,6 @@ type Config struct {
// protocol should be started or not. // protocol should be started or not.
DiscoveryV5 bool `toml:",omitempty"` DiscoveryV5 bool `toml:",omitempty"`
// Listener address for the V5 discovery protocol UDP traffic.
DiscoveryV5Addr string `toml:",omitempty"`
// Name sets the node name of this server. // Name sets the node name of this server.
// Use common.MakeName to create a name that follows existing conventions. // Use common.MakeName to create a name that follows existing conventions.
Name string `toml:"-"` Name string `toml:"-"`