Skip to content

Commit 0324ece

Browse files
committed
cmd/bootnode, p2p: log node URL instead of ENR
...and return the base64 record in NodeInfo.
1 parent 02f2919 commit 0324ece

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

cmd/bootnode/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func printNotice(nodeKey *ecdsa.PublicKey, addr net.UDPAddr) {
143143
addr.IP = net.IP{127, 0, 0, 1}
144144
}
145145
n := enode.NewV4(nodeKey, addr.IP, 0, addr.Port)
146-
fmt.Println(n.String())
146+
fmt.Println(n.URLv4())
147147
fmt.Println("Note: you're using cmd/bootnode, a developer tool.")
148148
fmt.Println("We recommend using a regular node as bootstrap node for production deployments.")
149149
}

p2p/server.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"github.com/ethereum/go-ethereum/p2p/enr"
4040
"github.com/ethereum/go-ethereum/p2p/nat"
4141
"github.com/ethereum/go-ethereum/p2p/netutil"
42-
"github.com/ethereum/go-ethereum/rlp"
4342
)
4443

4544
const (
@@ -602,7 +601,7 @@ type dialer interface {
602601
}
603602

604603
func (srv *Server) run(dialstate dialer) {
605-
srv.log.Info("Started P2P networking", "self", srv.localnode.Node())
604+
srv.log.Info("Started P2P networking", "self", srv.localnode.Node().URLv4())
606605
defer srv.loopWG.Done()
607606
defer srv.nodedb.Close()
608607

@@ -1034,17 +1033,15 @@ func (srv *Server) NodeInfo() *NodeInfo {
10341033
node := srv.Self()
10351034
info := &NodeInfo{
10361035
Name: srv.Name,
1037-
Enode: node.String(),
1036+
Enode: node.URLv4(),
10381037
ID: node.ID().String(),
10391038
IP: node.IP().String(),
10401039
ListenAddr: srv.ListenAddr,
10411040
Protocols: make(map[string]interface{}),
10421041
}
10431042
info.Ports.Discovery = node.UDP()
10441043
info.Ports.Listener = node.TCP()
1045-
if enc, err := rlp.EncodeToBytes(node.Record()); err == nil {
1046-
info.ENR = "0x" + hex.EncodeToString(enc)
1047-
}
1044+
info.ENR = node.String()
10481045

10491046
// Gather all the running protocol infos (only once per protocol type)
10501047
for _, proto := range srv.Protocols {

0 commit comments

Comments
 (0)