Skip to content

Commit 80a22fd

Browse files
jkczyznaumenkogs
authored andcommitted
Improve features module documentation
1 parent 6d1b389 commit 80a22fd

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lightning/src/ln/features.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
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
313
414
use std::{cmp, fmt};
515
use std::result::Result;
@@ -131,7 +141,7 @@ mod sealed { // You should just use the type aliases instead.
131141
/// Tracks the set of features which a node implements, templated by the context in which it
132142
/// appears.
133143
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)
135145
flags: Vec<u8>,
136146
mark: PhantomData<T>,
137147
}
@@ -155,11 +165,11 @@ impl<T: sealed::Context> fmt::Debug for Features<T> {
155165
}
156166
}
157167

158-
/// A feature message as it appears in an init message
168+
/// Features used within an `init` message.
159169
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.
161171
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.
163173
pub type ChannelFeatures = Features<sealed::ChannelContext>;
164174

165175
impl InitFeatures {

0 commit comments

Comments
 (0)