From 00240c62218b407b07e78273e6963f322654431f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 23 Mar 2018 15:46:04 -0700 Subject: [PATCH] lnwire: add new ErrUnknownAddrType for unknown addr types during parsing --- lnwire/node_announcement.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lnwire/node_announcement.go b/lnwire/node_announcement.go index 7a3b1f1d..753fca58 100644 --- a/lnwire/node_announcement.go +++ b/lnwire/node_announcement.go @@ -14,6 +14,19 @@ var ( endPort uint16 = 49151 ) +// ErrUnknownAddrType is an error returned if we encounter an unknown address type +// when parsing addresses. +type ErrUnknownAddrType struct { + addrType addressType +} + +// Error returns a human readable string describing the error. +// +// NOTE: implements the error interface. +func (e ErrUnknownAddrType) Error() string { + return fmt.Sprintf("unknown address type: %v", e.addrType) +} + // NodeAlias a hex encoded UTF-8 string that may be displayed as an alternative // to the node's ID. Notice that aliases are not unique and may be freely // chosen by the node operators.