1
- //! Lightning exposes sets of supported operations through "feature flags". This module includes
2
- //! types to store those feature flags and query for specific flags.
1
+ //! Feature flag definitions for the Lightning protocol according to [BOLT #9].
2
+ //!
3
+ //! Lightning nodes advertise a supported set of operation through feature flags. Features are
4
+ //! applicable for a specific context as indicated in some [messages]. [`Features`] encapsulates
5
+ //! behavior for specifying and checking feature flags for a particular context. Each feature is
6
+ //! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits). A
7
+ //! [`Context`] is used to parameterize [`Features`] and defines which features it can support.
8
+ //!
9
+ //! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
10
+ //! [messages]: ../msgs/index.html
11
+ //! [`Features`]: struct.Features.html
12
+ //! [`Context`]: sealed/trait.Context.html
3
13
4
14
use std:: { cmp, fmt} ;
5
15
use std:: result:: Result ;
@@ -131,7 +141,7 @@ mod sealed { // You should just use the type aliases instead.
131
141
/// Tracks the set of features which a node implements, templated by the context in which it
132
142
/// appears.
133
143
pub struct Features < T : sealed:: Context > {
134
- /// Note that, for convinience , flags is LITTLE endian (despite being big-endian on the wire)
144
+ /// Note that, for convenience , flags is LITTLE endian (despite being big-endian on the wire)
135
145
flags : Vec < u8 > ,
136
146
mark : PhantomData < T > ,
137
147
}
@@ -155,11 +165,11 @@ impl<T: sealed::Context> fmt::Debug for Features<T> {
155
165
}
156
166
}
157
167
158
- /// A feature message as it appears in an init message
168
+ /// Features used within an ` init` message.
159
169
pub type InitFeatures = Features < sealed:: InitContext > ;
160
- /// A feature message as it appears in a node_announcement message
170
+ /// Features used within a ` node_announcement` message.
161
171
pub type NodeFeatures = Features < sealed:: NodeContext > ;
162
- /// A feature message as it appears in a channel_announcement message
172
+ /// Features used within a ` channel_announcement` message.
163
173
pub type ChannelFeatures = Features < sealed:: ChannelContext > ;
164
174
165
175
impl InitFeatures {
0 commit comments