mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
lnwire: prep wire messages for TLV extensions
Messages: - UpdateFulfillHTLC - UpdateFee - UpdateFailMalformedHTLC - UpdateFailHTLC - UpdateAddHTLC - Shutdown - RevokeAndAck - ReplyShortChanIDsEnd - ReplyChannelRange - QueryShortChanIDs - QueryChannelRange - NodeAnnouncement - Init - GossipTimestampRange - FundingSigned - FundingLocked - FundingCreated - CommitSig - ClosingSigned - ChannelUpdate - ChannelReestablish - ChannelAnnouncement - AnnounceSignatures lnwire: update quickcheck tests, use constant for Error multi: update unit tests to pass deep equal assertions with messages In this commit, we update a series of unit tests in the code base to now pass due to the new wire message encode/decode logic. In many instances, we'll now manually set the extra bytes to an empty byte slice to avoid comparisons that fail due to one message having an empty byte slice and the other having a nil pointer.
This commit is contained in:
committed by
Johan T. Halseth
parent
a603ac4938
commit
9a6bb19770
@@ -22,6 +22,11 @@ type ReplyShortChanIDsEnd struct {
|
||||
// set of short chan ID's in the corresponding QueryShortChanIDs
|
||||
// message.
|
||||
Complete uint8
|
||||
|
||||
// ExtraData is the set of data that was appended to this message to
|
||||
// fill out the full maximum transport message size. These fields can
|
||||
// be used to specify optional data such as custom TLV fields.
|
||||
ExtraData ExtraOpaqueData
|
||||
}
|
||||
|
||||
// NewReplyShortChanIDsEnd creates a new empty ReplyShortChanIDsEnd message.
|
||||
@@ -41,6 +46,7 @@ func (c *ReplyShortChanIDsEnd) Decode(r io.Reader, pver uint32) error {
|
||||
return ReadElements(r,
|
||||
c.ChainHash[:],
|
||||
&c.Complete,
|
||||
&c.ExtraData,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,6 +58,7 @@ func (c *ReplyShortChanIDsEnd) Encode(w io.Writer, pver uint32) error {
|
||||
return WriteElements(w,
|
||||
c.ChainHash[:],
|
||||
c.Complete,
|
||||
c.ExtraData,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -69,6 +76,5 @@ func (c *ReplyShortChanIDsEnd) MsgType() MessageType {
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (c *ReplyShortChanIDsEnd) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 (chain hash) + 1 (complete)
|
||||
return 33
|
||||
return MaxMsgBody
|
||||
}
|
||||
|
Reference in New Issue
Block a user