mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
lnwire: add AnnounceSignatures interface
Add a AnnounceSignatures interface and ensure that AnnounceSignatures1 implements it.
This commit is contained in:
parent
df65b7cad9
commit
f230e2c574
2 changed files with 33 additions and 2 deletions
|
@ -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
|
||||||
|
}
|
||||||
|
|
13
lnwire/interfaces.go
Normal file
13
lnwire/interfaces.go
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue