lnwire: let gossip messages implement GossipMessage
This commit is contained in:
1 parent
4d3bf6379a
commit
ef0e6b78bb
9 files changed
+60
No files matched your search
@@ -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
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user