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

lightningnetwork / lnd / 16034820197

02 Jul 2025 08:11PM UTC coverage: 57.761% (-9.8%) from 67.589%
16034820197

Pull #10018

github

web-flow
Merge a11ccc22c into 8a0341419
Pull Request #10018: Refactor link's long methods

415 of 786 new or added lines in 1 file covered. (52.8%)

28401 existing lines in 456 files now uncovered.

98450 of 170445 relevant lines covered (57.76%)

1.79 hits per line

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

0.0
/lnwire/pong.go
1
package lnwire
2

3
import (
4
        "bytes"
5
        "fmt"
6
        "io"
7
)
8

9
// MaxPongBytes is the maximum number of extra bytes a pong can be requested to
10
// send. The type of the message (19) takes 2 bytes, the length field takes up
11
// 2 bytes, leaving 65531 bytes.
12
const MaxPongBytes = 65531
13

14
// ErrMaxPongBytesExceeded indicates that the NumPongBytes field from the ping
15
// message has exceeded MaxPongBytes.
16
var ErrMaxPongBytesExceeded = fmt.Errorf("pong bytes exceeded")
17

18
// PongPayload is a set of opaque bytes sent in response to a ping message.
19
type PongPayload []byte
20

21
// Pong defines a message which is the direct response to a received Ping
22
// message. A Pong reply indicates that a connection is still active. The Pong
23
// reply to a Ping message should contain the nonce carried in the original
24
// Pong message.
25
type Pong struct {
26
        // PongBytes is a set of opaque bytes that corresponds to the
27
        // NumPongBytes defined in the ping message that this pong is
28
        // replying to.
29
        PongBytes PongPayload
30
}
31

32
// NewPong returns a new Pong message.
33
func NewPong(pongBytes []byte) *Pong {
×
34
        return &Pong{
×
35
                PongBytes: pongBytes,
×
36
        }
×
37
}
×
38

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

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

46
// Decode deserializes a serialized Pong message stored in the passed io.Reader
47
// observing the specified protocol version.
48
//
49
// This is part of the lnwire.Message interface.
UNCOV
50
func (p *Pong) Decode(r io.Reader, pver uint32) error {
×
UNCOV
51
        return ReadElements(r,
×
UNCOV
52
                &p.PongBytes,
×
UNCOV
53
        )
×
UNCOV
54
}
×
55

56
// Encode serializes the target Pong into the passed io.Writer observing the
57
// protocol version specified.
58
//
59
// This is part of the lnwire.Message interface.
UNCOV
60
func (p *Pong) Encode(w *bytes.Buffer, pver uint32) error {
×
UNCOV
61
        return WritePongPayload(w, p.PongBytes)
×
UNCOV
62
}
×
63

64
// MsgType returns the integer uniquely identifying this message type on the
65
// wire.
66
//
67
// This is part of the lnwire.Message interface.
UNCOV
68
func (p *Pong) MsgType() MessageType {
×
UNCOV
69
        return MsgPong
×
UNCOV
70
}
×
71

72
// SerializedSize returns the serialized size of the message in bytes.
73
//
74
// This is part of the lnwire.SizeableMessage interface.
UNCOV
75
func (p *Pong) SerializedSize() (uint32, error) {
×
UNCOV
76
        return MessageSerializedSize(p)
×
UNCOV
77
}
×
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