• 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

57.14
/lnwire/closing_sig.go
1
package lnwire
2

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

7
        "github.com/btcsuite/btcd/btcutil"
8
)
9

10
// ClosingSig is sent in response to a ClosingComplete message. It carries the
11
// signatures of the closee to the closer.
12
type ClosingSig struct {
13
        // ChannelID serves to identify which channel is to be closed.
14
        ChannelID ChannelID
15

16
        // CloserScript is the script to which the channel funds will be paid
17
        // for the closer (the person sending the ClosingComplete) message.
18
        CloserScript DeliveryAddress
19

20
        // CloseeScript is the script to which the channel funds will be paid
21
        // (the person receiving the ClosingComplete message).
22
        CloseeScript DeliveryAddress
23

24
        // FeeSatoshis is the total fee in satoshis that the party to the
25
        // channel proposed for the close transaction.
26
        FeeSatoshis btcutil.Amount
27

28
        // LockTime is the locktime number to be used in the input spending the
29
        // funding transaction.
30
        LockTime uint32
31

32
        // ClosingSigs houses the 3 possible signatures that can be sent.
33
        ClosingSigs
34

35
        // ExtraData is the set of data that was appended to this message to
36
        // fill out the full maximum transport message size. These fields can
37
        // be used to specify optional data such as custom TLV fields.
38
        ExtraData ExtraOpaqueData
39
}
40

41
// Decode deserializes a serialized ClosingSig message stored in the passed
42
// io.Reader.
43
func (c *ClosingSig) Decode(r io.Reader, _ uint32) error {
3✔
44
        // First, read out all the fields that are hard coded into the message.
3✔
45
        err := ReadElements(
3✔
46
                r, &c.ChannelID, &c.CloserScript, &c.CloseeScript,
3✔
47
                &c.FeeSatoshis, &c.LockTime,
3✔
48
        )
3✔
49
        if err != nil {
3✔
UNCOV
50
                return err
×
UNCOV
51
        }
×
52

53
        // With the hard coded messages read, we'll now read out the TLV fields
54
        // of the message.
55
        var tlvRecords ExtraOpaqueData
3✔
56
        if err := ReadElements(r, &tlvRecords); err != nil {
3✔
57
                return err
×
58
        }
×
59

60
        if err := decodeClosingSigs(&c.ClosingSigs, tlvRecords); err != nil {
3✔
61
                return err
×
62
        }
×
63

64
        if len(tlvRecords) != 0 {
6✔
65
                c.ExtraData = tlvRecords
3✔
66
        }
3✔
67

68
        return nil
3✔
69
}
70

71
// Encode serializes the target ClosingSig into the passed io.Writer.
72
func (c *ClosingSig) Encode(w *bytes.Buffer, _ uint32) error {
3✔
73
        if err := WriteChannelID(w, c.ChannelID); err != nil {
3✔
74
                return err
×
75
        }
×
76

77
        if err := WriteDeliveryAddress(w, c.CloserScript); err != nil {
3✔
78
                return err
×
79
        }
×
80
        if err := WriteDeliveryAddress(w, c.CloseeScript); err != nil {
3✔
81
                return err
×
82
        }
×
83

84
        if err := WriteSatoshi(w, c.FeeSatoshis); err != nil {
3✔
85
                return err
×
86
        }
×
87

88
        if err := WriteUint32(w, c.LockTime); err != nil {
3✔
89
                return err
×
90
        }
×
91

92
        recordProducers := closingSigRecords(&c.ClosingSigs)
3✔
93

3✔
94
        err := EncodeMessageExtraData(&c.ExtraData, recordProducers...)
3✔
95
        if err != nil {
3✔
96
                return err
×
97
        }
×
98

99
        return WriteBytes(w, c.ExtraData)
3✔
100
}
101

102
// MsgType returns the uint32 code which uniquely identifies this message as a
103
// ClosingSig message on the wire.
104
//
105
// This is part of the lnwire.Message interface.
106
func (c *ClosingSig) MsgType() MessageType {
3✔
107
        return MsgClosingSig
3✔
108
}
3✔
109

110
// SerializedSize returns the serialized size of the message in bytes.
111
//
112
// This is part of the lnwire.SizeableMessage interface.
113
func (c *ClosingSig) SerializedSize() (uint32, error) {
×
114
        return MessageSerializedSize(c)
×
115
}
×
116

117
// A compile time check to ensure ClosingSig implements the lnwire.Message
118
// interface.
119
var _ Message = (*ClosingSig)(nil)
120

121
// A compile time check to ensure ClosingSig implements the
122
// lnwire.SizeableMessage interface.
123
var _ SizeableMessage = (*ClosingSig)(nil)
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