diff --git a/lnwire/lnwire.go b/lnwire/lnwire.go index f25163dec..e5c6064e7 100644 --- a/lnwire/lnwire.go +++ b/lnwire/lnwire.go @@ -747,10 +747,7 @@ func readElement(r io.Reader, element interface{}) error { return err } - *e, err = newAlias(a[:]) - if err != nil { - return err - } + *e = newAlias(a[:]) default: return fmt.Errorf("Unknown type in readElement: %T", e) } diff --git a/lnwire/node_announcement.go b/lnwire/node_announcement.go index 2e4127629..297a6e5df 100644 --- a/lnwire/node_announcement.go +++ b/lnwire/node_announcement.go @@ -31,12 +31,12 @@ type Alias struct { } // NewAlias create the alias from string and also checks spec requirements. -func NewAlias(s string) (Alias, error) { +func NewAlias(s string) Alias { data := []byte(s) return newAlias(data) } -func newAlias(data []byte) (Alias, error) { +func newAlias(data []byte) Alias { var a [32]byte rawAlias := data @@ -54,7 +54,7 @@ func newAlias(data []byte) (Alias, error) { return Alias{ data: a, aliasLen: aliasEnd, - }, nil + } } func (a *Alias) String() string { diff --git a/server.go b/server.go index fbfd5d2d9..a93245334 100644 --- a/server.go +++ b/server.go @@ -190,10 +190,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier, // In order to have ability to announce the self node we need to // sign the node announce message, and include the signature in the // node channeldb object. - alias, err := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10])) - if err != nil { - return nil, fmt.Errorf("can't create alias: %v", err) - } + alias := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10])) self := &channeldb.LightningNode{ LastUpdate: time.Now(), Addresses: selfAddrs,