mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
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:
@@ -36,6 +36,10 @@ func NewUpdateFee(chanID ChannelID, feePerKw uint32) *UpdateFee {
|
||||
// interface.
|
||||
var _ Message = (*UpdateFee)(nil)
|
||||
|
||||
// A compile time check to ensure UpdateFee implements the
|
||||
// lnwire.SizeableMessage interface.
|
||||
var _ SizeableMessage = (*UpdateFee)(nil)
|
||||
|
||||
// Decode deserializes a serialized UpdateFee message stored in the passed
|
||||
// io.Reader observing the specified protocol version.
|
||||
//
|
||||
@@ -72,6 +76,13 @@ func (c *UpdateFee) MsgType() MessageType {
|
||||
return MsgUpdateFee
|
||||
}
|
||||
|
||||
// SerializedSize returns the serialized size of the message in bytes.
|
||||
//
|
||||
// This is part of the lnwire.SizeableMessage interface.
|
||||
func (c *UpdateFee) 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