• 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

0.0
/lnwire/announcement_signatures_2.go
1
package lnwire
2

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

7
        "pgregory.net/rapid"
8
)
9

10
// AnnounceSignatures2 is a direct message between two endpoints of a
11
// channel and serves as an opt-in mechanism to allow the announcement of
12
// a taproot channel to the rest of the network. It contains the necessary
13
// signatures by the sender to construct the channel_announcement_2 message.
14
type AnnounceSignatures2 struct {
15
        // ChannelID is the unique description of the funding transaction.
16
        // Channel id is better for users and debugging and short channel id is
17
        // used for quick test on existence of the particular utxo inside the
18
        // blockchain, because it contains information about block.
19
        ChannelID ChannelID
20

21
        // ShortChannelID is the unique description of the funding transaction.
22
        // It is constructed with the most significant 3 bytes as the block
23
        // height, the next 3 bytes indicating the transaction index within the
24
        // block, and the least significant two bytes indicating the output
25
        // index which pays to the channel.
26
        ShortChannelID ShortChannelID
27

28
        // PartialSignature is the combination of the partial Schnorr signature
29
        // created for the node's bitcoin key with the partial signature created
30
        // for the node's node ID key.
31
        PartialSignature PartialSig
32

33
        // ExtraOpaqueData is the set of data that was appended to this
34
        // message, some of which we may not actually know how to iterate or
35
        // parse. By holding onto this data, we ensure that we're able to
36
        // properly validate the set of signatures that cover these new fields,
37
        // and ensure we're able to make upgrades to the network in a forwards
38
        // compatible manner.
39
        ExtraOpaqueData ExtraOpaqueData
40
}
41

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

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

50
// A compile time check to ensure AnnounceSignatures2 implements the
51
// lnwire.TestMessage interface.
52
var _ TestMessage = (*AnnounceSignatures2)(nil)
53

54
// Decode deserializes a serialized AnnounceSignatures2 stored in the passed
55
// io.Reader observing the specified protocol version.
56
//
57
// This is part of the lnwire.Message interface.
UNCOV
58
func (a *AnnounceSignatures2) Decode(r io.Reader, _ uint32) error {
×
UNCOV
59
        return ReadElements(r,
×
UNCOV
60
                &a.ChannelID,
×
UNCOV
61
                &a.ShortChannelID,
×
UNCOV
62
                &a.PartialSignature,
×
UNCOV
63
                &a.ExtraOpaqueData,
×
UNCOV
64
        )
×
UNCOV
65
}
×
66

67
// Encode serializes the target AnnounceSignatures2 into the passed io.Writer
68
// observing the protocol version specified.
69
//
70
// This is part of the lnwire.Message interface.
UNCOV
71
func (a *AnnounceSignatures2) Encode(w *bytes.Buffer, _ uint32) error {
×
UNCOV
72
        if err := WriteChannelID(w, a.ChannelID); err != nil {
×
73
                return err
×
74
        }
×
75

UNCOV
76
        if err := WriteShortChannelID(w, a.ShortChannelID); err != nil {
×
77
                return err
×
78
        }
×
79

UNCOV
80
        if err := WriteElement(w, a.PartialSignature); err != nil {
×
81
                return err
×
82
        }
×
83

UNCOV
84
        return WriteBytes(w, a.ExtraOpaqueData)
×
85
}
86

87
// MsgType returns the integer uniquely identifying this message type on the
88
// wire.
89
//
90
// This is part of the lnwire.Message interface.
UNCOV
91
func (a *AnnounceSignatures2) MsgType() MessageType {
×
UNCOV
92
        return MsgAnnounceSignatures2
×
UNCOV
93
}
×
94

95
// SerializedSize returns the serialized size of the message in bytes.
96
//
97
// This is part of the lnwire.SizeableMessage interface.
NEW
98
func (a *AnnounceSignatures2) SerializedSize() (uint32, error) {
×
NEW
99
        return MessageSerializedSize(a)
×
NEW
100
}
×
101

102
// SCID returns the ShortChannelID of the channel.
103
//
104
// NOTE: this is part of the AnnounceSignatures interface.
105
func (a *AnnounceSignatures2) SCID() ShortChannelID {
×
106
        return a.ShortChannelID
×
107
}
×
108

109
// ChanID returns the ChannelID identifying the channel.
110
//
111
// NOTE: this is part of the AnnounceSignatures interface.
112
func (a *AnnounceSignatures2) ChanID() ChannelID {
×
113
        return a.ChannelID
×
114
}
×
115

116
// RandTestMessage populates the message with random data suitable for testing.
117
// It uses the rapid testing framework to generate random values.
118
//
119
// This is part of the TestMessage interface.
NEW
120
func (a *AnnounceSignatures2) RandTestMessage(t *rapid.T) Message {
×
NEW
121
        return &AnnounceSignatures2{
×
NEW
122
                ChannelID:        RandChannelID(t),
×
NEW
123
                ShortChannelID:   RandShortChannelID(t),
×
NEW
124
                PartialSignature: *RandPartialSig(t),
×
NEW
125
                ExtraOpaqueData:  RandExtraOpaqueData(t, nil),
×
NEW
126
        }
×
NEW
127
}
×
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