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

lightningnetwork / lnd / 13999301927

21 Mar 2025 07:18PM UTC coverage: 68.989% (+9.9%) from 59.126%
13999301927

push

github

web-flow
Merge pull request #9623 from Roasbeef/size-msg-test-msg

Size msg test msg

1461 of 1572 new or added lines in 43 files covered. (92.94%)

28 existing lines in 6 files now uncovered.

132898 of 192637 relevant lines covered (68.99%)

22200.59 hits per line

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

51.43
/lnwire/announcement_signatures.go
1
package lnwire
2

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

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

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

26
        // NodeSignature is the signature which contains the signed announce
27
        // channel message, by this signature we proof that we possess of the
28
        // node pub key and creating the reference node_key -> bitcoin_key.
29
        NodeSignature Sig
30

31
        // BitcoinSignature is the signature which contains the signed node
32
        // public key, by this signature we proof that we possess of the
33
        // bitcoin key and and creating the reverse reference bitcoin_key ->
34
        // node_key.
35
        BitcoinSignature Sig
36

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

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

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

54
// A compile time check to ensure AnnounceSignatures1 implements the
55
// lnwire.AnnounceSignatures interface.
56
var _ AnnounceSignatures = (*AnnounceSignatures1)(nil)
57

58
// Decode deserializes a serialized AnnounceSignatures1 stored in the passed
59
// io.Reader observing the specified protocol version.
60
//
61
// This is part of the lnwire.Message interface.
62
func (a *AnnounceSignatures1) Decode(r io.Reader, _ uint32) error {
146✔
63
        return ReadElements(r,
146✔
64
                &a.ChannelID,
146✔
65
                &a.ShortChannelID,
146✔
66
                &a.NodeSignature,
146✔
67
                &a.BitcoinSignature,
146✔
68
                &a.ExtraOpaqueData,
146✔
69
        )
146✔
70
}
146✔
71

72
// Encode serializes the target AnnounceSignatures1 into the passed io.Writer
73
// observing the protocol version specified.
74
//
75
// This is part of the lnwire.Message interface.
76
func (a *AnnounceSignatures1) Encode(w *bytes.Buffer, _ uint32) error {
125✔
77
        if err := WriteChannelID(w, a.ChannelID); err != nil {
125✔
78
                return err
×
79
        }
×
80

81
        if err := WriteShortChannelID(w, a.ShortChannelID); err != nil {
125✔
82
                return err
×
83
        }
×
84

85
        if err := WriteSig(w, a.NodeSignature); err != nil {
125✔
86
                return err
×
87
        }
×
88

89
        if err := WriteSig(w, a.BitcoinSignature); err != nil {
125✔
90
                return err
×
91
        }
×
92

93
        return WriteBytes(w, a.ExtraOpaqueData)
125✔
94
}
95

96
// MsgType returns the integer uniquely identifying this message type on the
97
// wire.
98
//
99
// This is part of the lnwire.Message interface.
100
func (a *AnnounceSignatures1) MsgType() MessageType {
182✔
101
        return MsgAnnounceSignatures
182✔
102
}
182✔
103

104
// SerializedSize returns the serialized size of the message in bytes.
105
//
106
// This is part of the lnwire.SizeableMessage interface.
NEW
107
func (a *AnnounceSignatures1) SerializedSize() (uint32, error) {
×
NEW
108
        return MessageSerializedSize(a)
×
NEW
109
}
×
110

111
// SCID returns the ShortChannelID of the channel.
112
//
113
// This is part of the lnwire.AnnounceSignatures interface.
114
func (a *AnnounceSignatures1) SCID() ShortChannelID {
×
115
        return a.ShortChannelID
×
116
}
×
117

118
// ChanID returns the ChannelID identifying the channel.
119
//
120
// This is part of the lnwire.AnnounceSignatures interface.
121
func (a *AnnounceSignatures1) ChanID() ChannelID {
×
122
        return a.ChannelID
×
123
}
×
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