lnwire: Trim zero-bytes from NodeAlias String representation

This commit alters the NodeAlias String method to trim null-bytes from
the end of the alias. This is helpful for presentation in contexts such
as the GetInfo response.
This commit is contained in:
Benjamin Congdon 2017-12-15 17:02:04 -06:00
parent f1f1c8a257
commit ecff8f2a07
No known key found for this signature in database
GPG Key ID: 148FEE4C2C805D4A

@ -40,7 +40,8 @@ func NewNodeAlias(s string) (NodeAlias, error) {
// String returns a utf8 string representation of the alias bytes.
func (n NodeAlias) String() string {
return string(n[:])
// Trim trailing zero-bytes for presentation
return string(bytes.Trim(n[:], "\x00"))
}
// NodeAnnouncement message is used to announce the presence of a Lightning