lnwire: add new SerializedSize method to all wire messages
This'll be useful for the bandwidth based rate limiting we'll implement in the next commit.
This commit is contained in:
40 files changed
+453
-4
No files matched your search
@@ -44,12 +44,16 @@ func NewUpdateFulfillHTLC(chanID ChannelID, id uint64,
|
||||
}
|
||||
}
|
||||
|
||||
// A compile time check to ensure UpdateFulfillHTLC implements the lnwire.Message
|
||||
// interface.
|
||||
// A compile time check to ensure UpdateFulfillHTLC implements the
|
||||
// lnwire.Message interface.
|
||||
var _ Message = (*UpdateFulfillHTLC)(nil)
|
||||
|
||||
// Decode deserializes a serialized UpdateFulfillHTLC message stored in the passed
|
||||
// io.Reader observing the specified protocol version.
|
||||
// A compile time check to ensure UpdateFulfillHTLC implements the
|
||||
// lnwire.SizeableMessage interface.
|
||||
var _ SizeableMessage = (*UpdateFulfillHTLC)(nil)
|
||||
|
||||
// Decode deserializes a serialized UpdateFulfillHTLC message stored in the
|
||||
// passed io.Reader observing the specified protocol version.
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (c *UpdateFulfillHTLC) Decode(r io.Reader, pver uint32) error {
|
||||
@@ -115,6 +119,13 @@ func (c *UpdateFulfillHTLC) MsgType() MessageType {
|
||||
return MsgUpdateFulfillHTLC
|
||||
}
|
||||
|
||||
// SerializedSize returns the serialized size of the message in bytes.
|
||||
//
|
||||
// This is part of the lnwire.SizeableMessage interface.
|
||||
func (c *UpdateFulfillHTLC) SerializedSize() (uint32, error) {
|
||||
return MessageSerializedSize(c)
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user