Skip to content

Commit 49b1a18

Browse files
committed
bootnode: discovery v5 bootnode option
1 parent 084a8ec commit 49b1a18

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cmd/bootnode/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/ethereum/go-ethereum/crypto"
2828
"github.com/ethereum/go-ethereum/logger/glog"
2929
"github.com/ethereum/go-ethereum/p2p/discover"
30+
"github.com/ethereum/go-ethereum/p2p/discv5"
3031
"github.com/ethereum/go-ethereum/p2p/nat"
3132
)
3233

@@ -38,6 +39,7 @@ func main() {
3839
nodeKeyFile = flag.String("nodekey", "", "private key filename")
3940
nodeKeyHex = flag.String("nodekeyhex", "", "private key as hex (for testing)")
4041
natdesc = flag.String("nat", "none", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
42+
runv5 = flag.Bool("v5", false, "run a v5 topic discovery bootnode")
4143

4244
nodeKey *ecdsa.PrivateKey
4345
err error
@@ -79,8 +81,15 @@ func main() {
7981
os.Exit(0)
8082
}
8183

82-
if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm, ""); err != nil {
83-
utils.Fatalf("%v", err)
84+
if *runv5 {
85+
if _, err := discv5.ListenUDP(nodeKey, *listenAddr, natm, ""); err != nil {
86+
utils.Fatalf("%v", err)
87+
}
88+
} else {
89+
if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm, ""); err != nil {
90+
utils.Fatalf("%v", err)
91+
}
8492
}
93+
8594
select {}
8695
}

p2p/discv5/net.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const testTopic = "foo"
4949

5050
const (
5151
printDebugLogs = false
52-
printTestImgLogs = true
52+
printTestImgLogs = false
5353
)
5454

5555
func debugLog(s string) {

0 commit comments

Comments
 (0)