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

lightningnetwork / lnd / 18197857992

02 Oct 2025 03:32PM UTC coverage: 66.622% (-0.02%) from 66.646%
18197857992

Pull #10267

github

web-flow
Merge 0d9bfccfe into 1c2ff4a7e
Pull Request #10267: [g175] multi: small G175 preparations

24 of 141 new or added lines in 12 files covered. (17.02%)

64 existing lines in 20 files now uncovered.

137216 of 205963 relevant lines covered (66.62%)

21302.01 hits per line

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

0.0
/lnwire/interfaces.go
1
package lnwire
2

3
import (
4
        "fmt"
5

6
        "github.com/btcsuite/btcd/chaincfg/chainhash"
7
)
8

9
// GossipVersion is a version number that describes the version of the
10
// gossip protocol that a gossip message was gossiped on.
11
type GossipVersion uint8
12

13
const (
14
        // GossipVersion1 is the initial version of the gossip protocol as
15
        // defined in BOLT 7. This version of the protocol can only gossip P2WSH
16
        // channels and makes use of ECDSA signatures.
17
        GossipVersion1 GossipVersion = 1
18

19
        // GossipVersion2 is the newest version of the gossip protocol. This
20
        // version adds support for P2TR channels and makes use of Schnorr
21
        // signatures. The BOLT number is TBD.
22
        GossipVersion2 GossipVersion = 2
23
)
24

25
// String returns a string representation of the protocol version.
NEW
26
func (v GossipVersion) String() string {
×
NEW
27
        return fmt.Sprintf("V%d", v)
×
NEW
28
}
×
29

30
// GossipMessage is an interface that must be satisfied by all messages that are
31
// part of the gossip protocol.
32
type GossipMessage interface {
33
        // GossipVersion returns the version of the gossip protocol that a
34
        // message is part of.
35
        GossipVersion() GossipVersion
36
}
37

38
// AnnounceSignatures is an interface that represents a message used to
39
// exchange signatures of a ChannelAnnouncment message during the funding flow.
40
type AnnounceSignatures interface {
41
        // SCID returns the ShortChannelID of the channel.
42
        SCID() ShortChannelID
43

44
        // ChanID returns the ChannelID identifying the channel.
45
        ChanID() ChannelID
46

47
        Message
48
        GossipMessage
49
}
50

51
// ChannelAnnouncement is an interface that must be satisfied by any message
52
// used to announce and prove the existence of a channel.
53
type ChannelAnnouncement interface {
54
        // SCID returns the short channel ID of the channel.
55
        SCID() ShortChannelID
56

57
        // GetChainHash returns the hash of the chain which this channel's
58
        // funding transaction is confirmed in.
59
        GetChainHash() chainhash.Hash
60

61
        // Node1KeyBytes returns the bytes representing the public key of node
62
        // 1 in the channel.
63
        Node1KeyBytes() [33]byte
64

65
        // Node2KeyBytes returns the bytes representing the public key of node
66
        // 2 in the channel.
67
        Node2KeyBytes() [33]byte
68

69
        Message
70
        GossipMessage
71
}
72

73
// CompareResult represents the result after comparing two things.
74
type CompareResult uint8
75

76
const (
77
        // LessThan indicates that base object is less than the object it was
78
        // compared to.
79
        LessThan CompareResult = iota
80

81
        // EqualTo indicates that the base object is equal to the object it was
82
        // compared to.
83
        EqualTo
84

85
        // GreaterThan indicates that base object is greater than the object it
86
        // was compared to.
87
        GreaterThan
88
)
89

90
// ChannelUpdate is an interface that describes a message used to update the
91
// forwarding rules of a channel.
92
type ChannelUpdate interface {
93
        // SCID returns the ShortChannelID of the channel that the update
94
        // applies to.
95
        SCID() ShortChannelID
96

97
        // IsNode1 is true if the update was produced by node 1 of the channel
98
        // peers. Node 1 is the node with the lexicographically smaller public
99
        // key.
100
        IsNode1() bool
101

102
        // IsDisabled is true if the update is announcing that the channel
103
        // should be considered disabled.
104
        IsDisabled() bool
105

106
        // GetChainHash returns the hash of the chain that the message is
107
        // referring to.
108
        GetChainHash() chainhash.Hash
109

110
        // ForwardingPolicy returns the set of forwarding constraints of the
111
        // update.
112
        ForwardingPolicy() *ForwardingPolicy
113

114
        // CmpAge can be used to determine if the update is older or newer than
115
        // the passed update. It returns LessThan if this update is older than
116
        // the passed update, GreaterThan if it is newer and EqualTo if they are
117
        // the same age.
118
        CmpAge(update ChannelUpdate) (CompareResult, error)
119

120
        // SetDisabledFlag can be used to adjust the disabled flag of an update.
121
        SetDisabledFlag(bool)
122

123
        // SetSCID can be used to overwrite the SCID of the update.
124
        SetSCID(scid ShortChannelID)
125

126
        Message
127
        GossipMessage
128
}
129

130
// NodeAnnouncement is an interface that must be satisfied by any message used
131
// to announce the existence of a node.
132
type NodeAnnouncement interface {
133
        // NodePub returns the identity public key of the node.
134
        NodePub() [33]byte
135

136
        // NodeFeatures returns the set of features supported by the node.
137
        NodeFeatures() *FeatureVector
138

139
        // TimestampDesc returns a human-readable description of the
140
        // timestamp of the announcement.
141
        TimestampDesc() string
142

143
        Message
144
        GossipMessage
145
}
146

147
// ForwardingPolicy defines the set of forwarding constraints advertised in a
148
// ChannelUpdate message.
149
type ForwardingPolicy struct {
150
        // TimeLockDelta is the minimum number of blocks that the node requires
151
        // to be added to the expiry of HTLCs. This is a security parameter
152
        // determined by the node operator. This value represents the required
153
        // gap between the time locks of the incoming and outgoing HTLC's set
154
        // to this node.
155
        TimeLockDelta uint16
156

157
        // BaseFee is the base fee that must be used for incoming HTLC's to
158
        // this particular channel. This value will be tacked onto the required
159
        // for a payment independent of the size of the payment.
160
        BaseFee MilliSatoshi
161

162
        // FeeRate is the fee rate that will be charged per millionth of a
163
        // satoshi.
164
        FeeRate MilliSatoshi
165

166
        // HtlcMinimumMsat is the minimum HTLC value which will be accepted.
167
        MinHTLC MilliSatoshi
168

169
        // HasMaxHTLC is true if the MaxHTLC field is provided in the update.
170
        HasMaxHTLC bool
171

172
        // HtlcMaximumMsat is the maximum HTLC value which will be accepted.
173
        MaxHTLC MilliSatoshi
174
}
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