p2p/discv5: fix reg lookup, polish code, use logger (#15737)

This commit is contained in:
Péter Szilágyi
2017-12-28 15:17:03 +02:00
committed by Felix Lange
parent 5369a5c54d
commit c15d76a40f
4 changed files with 141 additions and 144 deletions

View File

@ -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) {