From ecff8f2a07f9f2299d68b236e7bc234a46407482 Mon Sep 17 00:00:00 2001 From: Benjamin Congdon Date: Fri, 15 Dec 2017 17:02:04 -0600 Subject: [PATCH] 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. --- lnwire/node_announcement.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnwire/node_announcement.go b/lnwire/node_announcement.go index 9e9ce0cf..1eaeade3 100644 --- a/lnwire/node_announcement.go +++ b/lnwire/node_announcement.go @@ -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