lnwire: modify newAlias to no longer return an error
This commit is contained in:
parent
1b10db212e
commit
920fcf3392
@ -747,10 +747,7 @@ func readElement(r io.Reader, element interface{}) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
*e, err = newAlias(a[:])
|
*e = newAlias(a[:])
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Unknown type in readElement: %T", e)
|
return fmt.Errorf("Unknown type in readElement: %T", e)
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ type Alias struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewAlias create the alias from string and also checks spec requirements.
|
// 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)
|
data := []byte(s)
|
||||||
return newAlias(data)
|
return newAlias(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAlias(data []byte) (Alias, error) {
|
func newAlias(data []byte) Alias {
|
||||||
var a [32]byte
|
var a [32]byte
|
||||||
|
|
||||||
rawAlias := data
|
rawAlias := data
|
||||||
@ -54,7 +54,7 @@ func newAlias(data []byte) (Alias, error) {
|
|||||||
return Alias{
|
return Alias{
|
||||||
data: a,
|
data: a,
|
||||||
aliasLen: aliasEnd,
|
aliasLen: aliasEnd,
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Alias) String() string {
|
func (a *Alias) String() string {
|
||||||
|
@ -190,10 +190,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
// In order to have ability to announce the self node we need to
|
// In order to have ability to announce the self node we need to
|
||||||
// sign the node announce message, and include the signature in the
|
// sign the node announce message, and include the signature in the
|
||||||
// node channeldb object.
|
// node channeldb object.
|
||||||
alias, err := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10]))
|
alias := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10]))
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("can't create alias: %v", err)
|
|
||||||
}
|
|
||||||
self := &channeldb.LightningNode{
|
self := &channeldb.LightningNode{
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: time.Now(),
|
||||||
Addresses: selfAddrs,
|
Addresses: selfAddrs,
|
||||||
|
Loading…
Reference in New Issue
Block a user