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

lightningnetwork / lnd / 15561477203

10 Jun 2025 01:54PM UTC coverage: 58.351% (-10.1%) from 68.487%
15561477203

Pull #9356

github

web-flow
Merge 6440b25db into c6d6d4c0b
Pull Request #9356: lnrpc: add incoming/outgoing channel ids filter to forwarding history request

33 of 36 new or added lines in 2 files covered. (91.67%)

28366 existing lines in 455 files now uncovered.

97715 of 167461 relevant lines covered (58.35%)

1.81 hits per line

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

66.67
/lnwire/stfu.go
1
package lnwire
2

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

8
// Stfu is a message that is sent to lock the channel state prior to some other
9
// interactive protocol where channel updates need to be paused.
10
type Stfu struct {
11
        // ChanID identifies which channel needs to be frozen.
12
        ChanID ChannelID
13

14
        // Initiator is a byte that identifies whether we are the initiator of
15
        // this process.
16
        Initiator bool
17

18
        // ExtraData is the set of data that was appended to this message to
19
        // fill out the full maximum transport message size. These fields can
20
        // be used to specify optional data such as custom TLV fields.
21
        ExtraData ExtraOpaqueData
22
}
23

24
// A compile time check to ensure Stfu implements the lnwire.Message interface.
25
var _ Message = (*Stfu)(nil)
26

27
// A compile time check to ensure Stfu implements the lnwire.SizeableMessage
28
// interface.
29
var _ SizeableMessage = (*Stfu)(nil)
30

31
// Encode serializes the target Stfu into the passed io.Writer.
32
// Serialization will observe the rules defined by the passed protocol version.
33
//
34
// This is a part of the lnwire.Message interface.
35
func (s *Stfu) Encode(w *bytes.Buffer, _ uint32) error {
3✔
36
        if err := WriteChannelID(w, s.ChanID); err != nil {
3✔
37
                return err
×
38
        }
×
39

40
        if err := WriteBool(w, s.Initiator); err != nil {
3✔
41
                return err
×
42
        }
×
43

44
        return WriteBytes(w, s.ExtraData)
3✔
45
}
46

47
// Decode deserializes the serialized Stfu stored in the passed io.Reader
48
// into the target Stfu using the deserialization rules defined by the
49
// passed protocol version.
50
//
51
// This is a part of the lnwire.Message interface.
52
func (s *Stfu) Decode(r io.Reader, _ uint32) error {
3✔
53
        if err := ReadElements(
3✔
54
                r, &s.ChanID, &s.Initiator, &s.ExtraData,
3✔
55
        ); err != nil {
3✔
UNCOV
56
                return err
×
UNCOV
57
        }
×
58

59
        // This is required to pass the fuzz test round trip equality check.
60
        if len(s.ExtraData) == 0 {
6✔
61
                s.ExtraData = nil
3✔
62
        }
3✔
63

64
        return nil
3✔
65
}
66

67
// MsgType returns the MessageType code which uniquely identifies this message
68
// as a Stfu on the wire.
69
//
70
// This is part of the lnwire.Message interface.
71
func (s *Stfu) MsgType() MessageType {
3✔
72
        return MsgStfu
3✔
73
}
3✔
74

75
// SerializedSize returns the serialized size of the message in bytes.
76
//
77
// This is part of the lnwire.SizeableMessage interface.
UNCOV
78
func (s *Stfu) SerializedSize() (uint32, error) {
×
UNCOV
79
        return MessageSerializedSize(s)
×
UNCOV
80
}
×
81

82
// A compile time check to ensure Stfu implements the
83
// lnwire.LinkUpdater interface.
84
var _ LinkUpdater = (*Stfu)(nil)
85

86
// TargetChanID returns the channel id of the link for which this message is
87
// intended.
88
//
89
// NOTE: Part of peer.LinkUpdater interface.
90
func (s *Stfu) TargetChanID() ChannelID {
3✔
91
        return s.ChanID
3✔
92
}
3✔
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