aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discv5/node.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/discv5/node.go')
-rw-r--r--p2p/discv5/node.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/p2p/discv5/node.go b/p2p/discv5/node.go
index 2db7a508f..fd88a55b1 100644
--- a/p2p/discv5/node.go
+++ b/p2p/discv5/node.go
@@ -273,6 +273,11 @@ func (n NodeID) GoString() string {
return fmt.Sprintf("discover.HexID(\"%x\")", n[:])
}
+// TerminalString returns a shortened hex string for terminal logging.
+func (n NodeID) TerminalString() string {
+ return hex.EncodeToString(n[:8])
+}
+
// HexID converts a hex string to a NodeID.
// The string may be prefixed with 0x.
func HexID(in string) (NodeID, error) {