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

lightningnetwork / lnd / 15041263629

15 May 2025 09:16AM UTC coverage: 68.891% (-0.1%) from 68.997%
15041263629

Pull #9810

github

web-flow
Merge f6b50e055 into b0cba7dd0
Pull Request #9810: rpc: proper error code for GetChanInfo

4 of 7 new or added lines in 2 files covered. (57.14%)

275 existing lines in 30 files now uncovered.

133698 of 194071 relevant lines covered (68.89%)

22053.29 hits per line

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

74.42
/lnwire/funding_signed.go
1
package lnwire
2

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

7
        "github.com/lightningnetwork/lnd/tlv"
8
)
9

10
// FundingSigned is sent from Bob (the responder) to Alice (the initiator)
11
// after receiving the funding outpoint and her signature for Bob's version of
12
// the commitment transaction.
13
type FundingSigned struct {
14
        // ChannelPoint is the particular active channel that this
15
        // FundingSigned is bound to.
16
        ChanID ChannelID
17

18
        // CommitSig is Bob's signature for Alice's version of the commitment
19
        // transaction.
20
        CommitSig Sig
21

22
        // PartialSig is used to transmit a musig2 extended partial signature
23
        // that also carries along the public nonce of the signer.
24
        //
25
        // NOTE: This field is only populated if a musig2 taproot channel is
26
        // being signed for. In this case, the above Sig type MUST be blank.
27
        PartialSig OptPartialSigWithNonceTLV
28

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

35
// A compile time check to ensure FundingSigned implements the lnwire.Message
36
// interface.
37
var _ Message = (*FundingSigned)(nil)
38

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

43
// Encode serializes the target FundingSigned into the passed io.Writer
44
// implementation. Serialization will observe the rules defined by the passed
45
// protocol version.
46
//
47
// This is part of the lnwire.Message interface.
48
func (f *FundingSigned) Encode(w *bytes.Buffer, pver uint32) error {
112✔
49
        recordProducers := make([]tlv.RecordProducer, 0, 1)
112✔
50
        f.PartialSig.WhenSome(func(sig PartialSigWithNonceTLV) {
163✔
51
                recordProducers = append(recordProducers, &sig)
51✔
52
        })
51✔
53
        err := EncodeMessageExtraData(&f.ExtraData, recordProducers...)
112✔
54
        if err != nil {
112✔
55
                return err
×
56
        }
×
57

58
        if err := WriteChannelID(w, f.ChanID); err != nil {
112✔
59
                return err
×
60
        }
×
61

62
        if err := WriteSig(w, f.CommitSig); err != nil {
112✔
63
                return err
×
64
        }
×
65

66
        return WriteBytes(w, f.ExtraData)
112✔
67
}
68

69
// Decode deserializes the serialized FundingSigned stored in the passed
70
// io.Reader into the target FundingSigned using the deserialization rules
71
// defined by the passed protocol version.
72
//
73
// This is part of the lnwire.Message interface.
74
func (f *FundingSigned) Decode(r io.Reader, pver uint32) error {
170✔
75
        err := ReadElements(r, &f.ChanID, &f.CommitSig)
170✔
76
        if err != nil {
174✔
77
                return err
4✔
78
        }
4✔
79

80
        var tlvRecords ExtraOpaqueData
166✔
81
        if err := ReadElements(r, &tlvRecords); err != nil {
166✔
82
                return err
×
83
        }
×
84

85
        partialSig := f.PartialSig.Zero()
166✔
86
        typeMap, err := tlvRecords.ExtractRecords(&partialSig)
166✔
87
        if err != nil {
210✔
88
                return err
44✔
89
        }
44✔
90

91
        // Set the corresponding TLV types if they were included in the stream.
92
        if val, ok := typeMap[f.PartialSig.TlvType()]; ok && val == nil {
175✔
93
                f.PartialSig = tlv.SomeRecordT(partialSig)
53✔
94
        }
53✔
95

96
        if len(tlvRecords) != 0 {
182✔
97
                f.ExtraData = tlvRecords
60✔
98
        }
60✔
99

100
        return nil
122✔
101
}
102

103
// MsgType returns the uint32 code which uniquely identifies this message as a
104
// FundingSigned on the wire.
105
//
106
// This is part of the lnwire.Message interface.
107
func (f *FundingSigned) MsgType() MessageType {
112✔
108
        return MsgFundingSigned
112✔
109
}
112✔
110

111
// SerializedSize returns the serialized size of the message in bytes.
112
//
113
// This is part of the lnwire.SizeableMessage interface.
UNCOV
114
func (f *FundingSigned) SerializedSize() (uint32, error) {
×
UNCOV
115
        return MessageSerializedSize(f)
×
UNCOV
116
}
×
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