lnwire: add NodeAnnouncement interface
And ensure that both versions 1 and 2 implement it.
This commit is contained in:
1 parent
6cc7a88e99
commit
70054ac402
3 files changed
+68
No files matched your search
@@ -104,6 +104,10 @@ type NodeAnnouncement1 struct {
|
||||
// lnwire.Message interface.
|
||||
var _ Message = (*NodeAnnouncement1)(nil)
|
||||
|
||||
// A compile time check to ensure NodeAnnouncement1 implements the
|
||||
// lnwire.NodeAnnouncement interface.
|
||||
var _ NodeAnnouncement = (*NodeAnnouncement1)(nil)
|
||||
|
||||
// A compile time check to ensure NodeAnnouncement1 implements the
|
||||
// lnwire.SizeableMessage interface.
|
||||
var _ SizeableMessage = (*NodeAnnouncement1)(nil)
|
||||
@@ -217,3 +221,25 @@ func (a *NodeAnnouncement1) DataToSign() ([]byte, error) {
|
||||
func (a *NodeAnnouncement1) SerializedSize() (uint32, error) {
|
||||
return MessageSerializedSize(a)
|
||||
}
|
||||
|
||||
// NodePub returns the identity public key of the node.
|
||||
//
|
||||
// NOTE: part of the NodeAnnouncement interface.
|
||||
func (a *NodeAnnouncement1) NodePub() [33]byte {
|
||||
return a.NodeID
|
||||
}
|
||||
|
||||
// NodeFeatures returns the set of features supported by the node.
|
||||
//
|
||||
// NOTE: part of the NodeAnnouncement interface.
|
||||
func (a *NodeAnnouncement1) NodeFeatures() *FeatureVector {
|
||||
return NewFeatureVector(a.Features, Features)
|
||||
}
|
||||
|
||||
// TimestampDesc returns a human-readable description of the timestamp of the
|
||||
// announcement.
|
||||
//
|
||||
// NOTE: part of the NodeAnnouncement interface.
|
||||
func (a *NodeAnnouncement1) TimestampDesc() string {
|
||||
return fmt.Sprintf("timestamp=%d", a.Timestamp)
|
||||
}
|
||||
Reference in new issue
Block a user