diff --git a/lnwire/announcement_signatures.go b/lnwire/announcement_signatures.go index 3f0e72803..a2bc21f39 100644 --- a/lnwire/announcement_signatures.go +++ b/lnwire/announcement_signatures.go @@ -47,11 +47,15 @@ type AnnounceSignatures1 struct { // lnwire.Message interface. var _ Message = (*AnnounceSignatures1)(nil) +// A compile time check to ensure AnnounceSignatures1 implements the +// lnwire.AnnounceSignatures interface. +var _ AnnounceSignatures = (*AnnounceSignatures1)(nil) + // Decode deserializes a serialized AnnounceSignatures1 stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface. -func (a *AnnounceSignatures1) Decode(r io.Reader, pver uint32) error { +func (a *AnnounceSignatures1) Decode(r io.Reader, _ uint32) error { return ReadElements(r, &a.ChannelID, &a.ShortChannelID, @@ -65,7 +69,7 @@ func (a *AnnounceSignatures1) Decode(r io.Reader, pver uint32) error { // observing the protocol version specified. // // This is part of the lnwire.Message interface. -func (a *AnnounceSignatures1) Encode(w *bytes.Buffer, pver uint32) error { +func (a *AnnounceSignatures1) Encode(w *bytes.Buffer, _ uint32) error { if err := WriteChannelID(w, a.ChannelID); err != nil { return err } @@ -92,3 +96,17 @@ func (a *AnnounceSignatures1) Encode(w *bytes.Buffer, pver uint32) error { func (a *AnnounceSignatures1) MsgType() MessageType { return MsgAnnounceSignatures } + +// SCID returns the ShortChannelID of the channel. +// +// This is part of the lnwire.AnnounceSignatures interface. +func (a *AnnounceSignatures1) SCID() ShortChannelID { + return a.ShortChannelID +} + +// ChanID returns the ChannelID identifying the channel. +// +// This is part of the lnwire.AnnounceSignatures interface. +func (a *AnnounceSignatures1) ChanID() ChannelID { + return a.ChannelID +} diff --git a/lnwire/interfaces.go b/lnwire/interfaces.go new file mode 100644 index 000000000..f8e4373c3 --- /dev/null +++ b/lnwire/interfaces.go @@ -0,0 +1,13 @@ +package lnwire + +// AnnounceSignatures is an interface that represents a message used to +// exchange signatures of a ChannelAnnouncment message during the funding flow. +type AnnounceSignatures interface { + // SCID returns the ShortChannelID of the channel. + SCID() ShortChannelID + + // ChanID returns the ChannelID identifying the channel. + ChanID() ChannelID + + Message +}