• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13980275562

20 Mar 2025 10:06PM UTC coverage: 58.6% (-10.2%) from 68.789%
13980275562

Pull #9623

github

web-flow
Merge b9b960345 into 09b674508
Pull Request #9623: Size msg test msg

0 of 1518 new or added lines in 42 files covered. (0.0%)

26603 existing lines in 443 files now uncovered.

96807 of 165200 relevant lines covered (58.6%)

1.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.84
/lnwire/reply_short_chan_ids_end.go
1
package lnwire
2

3
import (
4
        "bytes"
5
        "io"
6

7
        "github.com/btcsuite/btcd/chaincfg/chainhash"
8
        "pgregory.net/rapid"
9
)
10

11
// ReplyShortChanIDsEnd is a message that marks the end of a streaming message
12
// response to an initial QueryShortChanIDs message. This marks that the
13
// receiver of the original QueryShortChanIDs for the target chain has either
14
// sent all adequate responses it knows of, or doesn't know of any short chan
15
// ID's for the target chain.
16
type ReplyShortChanIDsEnd struct {
17
        // ChainHash denotes the target chain that we're respond to a short
18
        // chan ID query for.
19
        ChainHash chainhash.Hash
20

21
        // Complete will be set to 0 if we don't know of the chain that the
22
        // remote peer sent their query for. Otherwise, we'll set this to 1 in
23
        // order to indicate that we've sent all known responses for the prior
24
        // set of short chan ID's in the corresponding QueryShortChanIDs
25
        // message.
26
        Complete uint8
27

28
        // ExtraData is the set of data that was appended to this message to
29
        // fill out the full maximum transport message size. These fields can
30
        // be used to specify optional data such as custom TLV fields.
31
        ExtraData ExtraOpaqueData
32
}
33

34
// NewReplyShortChanIDsEnd creates a new empty ReplyShortChanIDsEnd message.
35
func NewReplyShortChanIDsEnd() *ReplyShortChanIDsEnd {
×
36
        return &ReplyShortChanIDsEnd{}
×
37
}
×
38

39
// A compile time check to ensure ReplyShortChanIDsEnd implements the
40
// lnwire.Message interface.
41
var _ Message = (*ReplyShortChanIDsEnd)(nil)
42

43
// A compile time check to ensure ReplyShortChanIDsEnd implements the lnwire.SizeableMessage interface.
44
var _ SizeableMessage = (*ReplyShortChanIDsEnd)(nil)
45

46
// A compile time check to ensure ReplyShortChanIDsEnd implements the lnwire.TestMessage interface.
47
var _ TestMessage = (*ReplyShortChanIDsEnd)(nil)
48

49
// Decode deserializes a serialized ReplyShortChanIDsEnd message stored in the
50
// passed io.Reader observing the specified protocol version.
51
//
52
// This is part of the lnwire.Message interface.
53
func (c *ReplyShortChanIDsEnd) Decode(r io.Reader, pver uint32) error {
3✔
54
        return ReadElements(r,
3✔
55
                c.ChainHash[:],
3✔
56
                &c.Complete,
3✔
57
                &c.ExtraData,
3✔
58
        )
3✔
59
}
3✔
60

61
// Encode serializes the target ReplyShortChanIDsEnd into the passed io.Writer
62
// observing the protocol version specified.
63
//
64
// This is part of the lnwire.Message interface.
65
func (c *ReplyShortChanIDsEnd) Encode(w *bytes.Buffer, pver uint32) error {
3✔
66
        if err := WriteBytes(w, c.ChainHash[:]); err != nil {
3✔
UNCOV
67
                return err
×
UNCOV
68
        }
×
69

70
        if err := WriteUint8(w, c.Complete); err != nil {
3✔
UNCOV
71
                return err
×
UNCOV
72
        }
×
73

74
        return WriteBytes(w, c.ExtraData)
3✔
75
}
76

77
// MsgType returns the integer uniquely identifying this message type on the
78
// wire.
79
//
80
// This is part of the lnwire.Message interface.
81
func (c *ReplyShortChanIDsEnd) MsgType() MessageType {
3✔
82
        return MsgReplyShortChanIDsEnd
3✔
83
}
3✔
84

85
// SerializedSize returns the serialized size of the message in bytes.
86
//
87
// This is part of the lnwire.SizeableMessage interface.
NEW
88
func (c *ReplyShortChanIDsEnd) SerializedSize() (uint32, error) {
×
NEW
89
        return MessageSerializedSize(c)
×
NEW
90
}
×
91

92
// RandTestMessage populates the message with random data suitable for testing.
93
// It uses the rapid testing framework to generate random values.
94
//
95
// This is part of the TestMessage interface.
NEW
96
func (c *ReplyShortChanIDsEnd) RandTestMessage(t *rapid.T) Message {
×
NEW
97
        var chainHash chainhash.Hash
×
NEW
98
        hashBytes := rapid.SliceOfN(rapid.Byte(), 32, 32).Draw(t, "chainHash")
×
NEW
99
        copy(chainHash[:], hashBytes)
×
NEW
100

×
NEW
101
        complete := uint8(rapid.IntRange(0, 1).Draw(t, "complete"))
×
NEW
102

×
NEW
103
        return &ReplyShortChanIDsEnd{
×
NEW
104
                ChainHash: chainHash,
×
NEW
105
                Complete:  complete,
×
NEW
106
                ExtraData: RandExtraOpaqueData(t, nil),
×
NEW
107
        }
×
NEW
108
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc