diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2018-01-22 20:38:34 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-01-22 20:38:34 +0800 |
commit | 92580d69d3156e5d2f0788eb5d48664cc3fb0ef3 (patch) | |
tree | fc9a52735b2857802a18bcdd0964d5e861024ddd /cmd/utils/flags.go | |
parent | 02aeb3d76652a4c0451e5c3734e6881aefe46249 (diff) | |
download | go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar.gz go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar.bz2 go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar.lz go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar.xz go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.tar.zst go-tangerine-92580d69d3156e5d2f0788eb5d48664cc3fb0ef3.zip |
p2p, p2p/discover, p2p/discv5: implement UDP port sharing (#15200)
This commit affects p2p/discv5 "topic discovery" by running it on
the same UDP port where the old discovery works. This is realized
by giving an "unhandled" packet channel to the old v4 discovery
packet handler where all invalid packets are sent. These packets
are then processed by v5. v5 packets are always invalid when
interpreted by v4 and vice versa. This is ensured by adding one
to the first byte of the packet hash in v5 packets.
DiscoveryV5Bootnodes is also changed to point to new bootnodes
that are implementing the changed packet format with modified
hash. Existing and new v5 bootnodes are both running on different
ports ATM.
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r-- | cmd/utils/flags.go | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3766ea4a6..89dcd230c 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -636,14 +636,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. func setNAT(ctx *cli.Context, cfg *p2p.Config) { if ctx.GlobalIsSet(NATFlag.Name) { @@ -794,7 +786,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { setNodeKey(ctx, cfg) setNAT(ctx, cfg) setListenAddress(ctx, cfg) - setDiscoveryV5Address(ctx, cfg) setBootstrapNodes(ctx, cfg) setBootstrapNodesV5(ctx, cfg) @@ -830,7 +821,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { // --dev mode can't use p2p networking. cfg.MaxPeers = 0 cfg.ListenAddr = ":0" - cfg.DiscoveryV5Addr = ":0" cfg.NoDiscovery = true cfg.DiscoveryV5 = false } |