lnwire: add AnnounceSignatures interface
Add a AnnounceSignatures interface and ensure that AnnounceSignatures1 implements it.
This commit is contained in:
2 files changed
+33
-2
No files matched your search
@@ -47,11 +47,15 @@ type AnnounceSignatures1 struct {
|
|||||||
// lnwire.Message interface.
|
// lnwire.Message interface.
|
||||||
var _ Message = (*AnnounceSignatures1)(nil)
|
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
|
// Decode deserializes a serialized AnnounceSignatures1 stored in the passed
|
||||||
// io.Reader observing the specified protocol version.
|
// io.Reader observing the specified protocol version.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// 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,
|
return ReadElements(r,
|
||||||
&a.ChannelID,
|
&a.ChannelID,
|
||||||
&a.ShortChannelID,
|
&a.ShortChannelID,
|
||||||
@@ -65,7 +69,7 @@ func (a *AnnounceSignatures1) Decode(r io.Reader, pver uint32) error {
|
|||||||
// observing the protocol version specified.
|
// observing the protocol version specified.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// 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 {
|
if err := WriteChannelID(w, a.ChannelID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -92,3 +96,17 @@ func (a *AnnounceSignatures1) Encode(w *bytes.Buffer, pver uint32) error {
|
|||||||
func (a *AnnounceSignatures1) MsgType() MessageType {
|
func (a *AnnounceSignatures1) MsgType() MessageType {
|
||||||
return MsgAnnounceSignatures
|
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
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
Reference in new issue
Block a user