diff --git a/lnwire/announcement_signatures.go b/lnwire/announcement_signatures.go index cf8f68be5..29ada7008 100644 --- a/lnwire/announcement_signatures.go +++ b/lnwire/announcement_signatures.go @@ -121,3 +121,10 @@ func (a *AnnounceSignatures1) SCID() ShortChannelID { func (a *AnnounceSignatures1) ChanID() ChannelID { return a.ChannelID } + +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (a *AnnounceSignatures1) GossipVersion() GossipVersion { + return GossipVersion1 +} diff --git a/lnwire/announcement_signatures_2.go b/lnwire/announcement_signatures_2.go index 04e4c0a9f..a2806f1ee 100644 --- a/lnwire/announcement_signatures_2.go +++ b/lnwire/announcement_signatures_2.go @@ -102,6 +102,13 @@ func (a *AnnounceSignatures2) MsgType() MessageType { return MsgAnnounceSignatures2 } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (a *AnnounceSignatures2) GossipVersion() GossipVersion { + return GossipVersion2 +} + // SerializedSize returns the serialized size of the message in bytes. // // This is part of the lnwire.SizeableMessage interface. diff --git a/lnwire/channel_announcement.go b/lnwire/channel_announcement.go index 05161cca8..cab840728 100644 --- a/lnwire/channel_announcement.go +++ b/lnwire/channel_announcement.go @@ -232,6 +232,13 @@ func (a *ChannelAnnouncement1) SCID() ShortChannelID { return a.ShortChannelID } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (a *ChannelAnnouncement1) GossipVersion() GossipVersion { + return GossipVersion1 +} + // A compile-time check to ensure that ChannelAnnouncement1 implements the // ChannelAnnouncement interface. var _ ChannelAnnouncement = (*ChannelAnnouncement1)(nil) diff --git a/lnwire/channel_announcement_2.go b/lnwire/channel_announcement_2.go index a82624a51..9227584b6 100644 --- a/lnwire/channel_announcement_2.go +++ b/lnwire/channel_announcement_2.go @@ -307,6 +307,13 @@ func (c *ChannelAnnouncement2) SCID() ShortChannelID { return c.ShortChannelID.Val } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (c *ChannelAnnouncement2) GossipVersion() GossipVersion { + return GossipVersion2 +} + // A compile-time check to ensure that ChannelAnnouncement2 implements the // ChannelAnnouncement interface. var _ ChannelAnnouncement = (*ChannelAnnouncement2)(nil) diff --git a/lnwire/channel_update.go b/lnwire/channel_update.go index 2dc4a11ca..09b8044bd 100644 --- a/lnwire/channel_update.go +++ b/lnwire/channel_update.go @@ -363,6 +363,13 @@ func (a *ChannelUpdate1) ForwardingPolicy() *ForwardingPolicy { } } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (a *ChannelUpdate1) GossipVersion() GossipVersion { + return GossipVersion1 +} + // CmpAge can be used to determine if the update is older or newer than the // passed update. It returns 1 if this update is newer, -1 if it is older, and // 0 if they are the same age. diff --git a/lnwire/channel_update_2.go b/lnwire/channel_update_2.go index 7fe7670ed..8e82fe9d7 100644 --- a/lnwire/channel_update_2.go +++ b/lnwire/channel_update_2.go @@ -85,6 +85,13 @@ type ChannelUpdate2 struct { ExtraSignedFields } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (c *ChannelUpdate2) GossipVersion() GossipVersion { + return GossipVersion2 +} + // Encode serializes the target ChannelUpdate2 into the passed io.Writer // observing the protocol version specified. // diff --git a/lnwire/interfaces.go b/lnwire/interfaces.go index 64d87f7c1..115b07d7b 100644 --- a/lnwire/interfaces.go +++ b/lnwire/interfaces.go @@ -45,6 +45,7 @@ type AnnounceSignatures interface { ChanID() ChannelID Message + GossipMessage } // ChannelAnnouncement is an interface that must be satisfied by any message @@ -66,6 +67,7 @@ type ChannelAnnouncement interface { Node2KeyBytes() [33]byte Message + GossipMessage } // CompareResult represents the result after comparing two things. @@ -122,6 +124,7 @@ type ChannelUpdate interface { SetSCID(scid ShortChannelID) Message + GossipMessage } // NodeAnnouncement is an interface that must be satisfied by any message used @@ -138,6 +141,7 @@ type NodeAnnouncement interface { TimestampDesc() string Message + GossipMessage } // ForwardingPolicy defines the set of forwarding constraints advertised in a diff --git a/lnwire/node_announcement.go b/lnwire/node_announcement.go index 384327f37..468ac794e 100644 --- a/lnwire/node_announcement.go +++ b/lnwire/node_announcement.go @@ -243,3 +243,10 @@ func (a *NodeAnnouncement1) NodeFeatures() *FeatureVector { func (a *NodeAnnouncement1) TimestampDesc() string { return fmt.Sprintf("timestamp=%d", a.Timestamp) } + +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (a *NodeAnnouncement1) GossipVersion() GossipVersion { + return GossipVersion1 +} diff --git a/lnwire/node_announcement_2.go b/lnwire/node_announcement_2.go index 0b7142db0..93a3792a2 100644 --- a/lnwire/node_announcement_2.go +++ b/lnwire/node_announcement_2.go @@ -221,6 +221,13 @@ func (n *NodeAnnouncement2) TimestampDesc() string { return fmt.Sprintf("block_height=%d", n.BlockHeight.Val) } +// GossipVersion returns the gossip version that this message is part of. +// +// NOTE: this is part of the GossipMessage interface. +func (n *NodeAnnouncement2) GossipVersion() GossipVersion { + return GossipVersion2 +} + // A compile-time check to ensure NodeAnnouncement2 implements the Message // interface. var _ Message = (*NodeAnnouncement2)(nil)