Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lnwire/onion_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func NewOnionMessage(pathKey *btcec.PublicKey,
// A compile-time check to ensure OnionMessage implements the Message interface.
var _ Message = (*OnionMessage)(nil)

var _ SizeableMessage = (*OnionMessage)(nil)

// Decode reads the bytes stream and converts it to the object.
func (o *OnionMessage) Decode(r io.Reader, _ uint32) error {
if err := ReadElement(r, &o.PathKey); err != nil {
Expand Down Expand Up @@ -79,3 +81,10 @@ func (o *OnionMessage) Encode(w *bytes.Buffer, _ uint32) error {
func (o *OnionMessage) MsgType() MessageType {
return MsgOnionMessage
}

// SerializedSize returns the serialized size of the message in bytes.
//
// This is part of the lnwire.SizeableMessage interface.
func (o *OnionMessage) SerializedSize() (uint32, error) {
return MessageSerializedSize(o)
}
Loading