Skip to content

Commit a2508f5

Browse files
committed
Docs improvements
1 parent 2d213a4 commit a2508f5

File tree

7 files changed

+110
-89
lines changed

7 files changed

+110
-89
lines changed

fuzz/src/full_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ mod tests {
861861
// 0085 3d00000000000000000000000000000000000000000000000000000000000000 0900000000000000000000000000000000000000000000000000000000000000 020b00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000 - revoke_and_ack and mac
862862
//
863863
// 07 - process the now-pending HTLC forward
864-
// - client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: SendHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
864+
// - client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
865865
//
866866
// - we respond with commitment_signed then revoke_and_ack (a weird, but valid, order)
867867
// 030112 - inbound read from peer id 1 of len 18

lightning-invoice/src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use core::time::Duration;
3838
///
3939
/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
4040
/// in excess of the current time.
41-
///
41+
///
4242
/// `duration_since_epoch` is the current time since epoch in seconds.
4343
///
4444
/// You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
@@ -56,7 +56,7 @@ use core::time::Duration;
5656
/// [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5757
/// [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
5858
/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
59-
///
59+
///
6060
/// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
6161
/// available and the current time is supplied by the caller.
6262
pub fn create_phantom_invoice<ES: Deref, NS: Deref, L: Deref>(
@@ -98,7 +98,7 @@ where
9898
///
9999
/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
100100
/// in excess of the current time.
101-
///
101+
///
102102
/// `duration_since_epoch` is the current time since epoch in seconds.
103103
///
104104
/// Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
@@ -110,7 +110,7 @@ where
110110
/// [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
111111
/// [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
112112
/// [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
113-
///
113+
///
114114
/// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
115115
/// available and the current time is supplied by the caller.
116116
pub fn create_phantom_invoice_with_description_hash<ES: Deref, NS: Deref, L: Deref>(

lightning/src/ln/chan_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// licenses.
99

1010
//! Various utilities for building scripts and deriving keys related to channels. These are
11-
//! largely of interest for those implementing chain::keysinterface::Sign message signing by hand.
11+
//! largely of interest for those implementing the traits on [`chain::keysinterface`] by hand.
1212
1313
use bitcoin::blockdata::script::{Script,Builder};
1414
use bitcoin::blockdata::opcodes;

lightning/src/ln/channelmanager.rs

Lines changed: 83 additions & 56 deletions
Large diffs are not rendered by default.

lightning/src/ln/mod.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,7 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
//! High level lightning structs and impls live here.
11-
//!
12-
//! You probably want to create a [`ChannelManager`], and a [`P2PGossipSync`] first.
13-
//! Then, you probably want to pass them both on to a peer_handler::PeerManager and use that to
14-
//! create/manage connections and call get_and_clear_pending_events after each action, handling
15-
//! them appropriately.
16-
//!
17-
//! When you want to open/close a channel or send a payment, call into your [`ChannelManager`] and
18-
//! when you want to learn things about the network topology (eg get a route for sending a payment),
19-
//! call into your [`P2PGossipSync`].
20-
//!
21-
//! [`ChannelManager`]: channelmanager::ChannelManager
22-
//! [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
10+
//! Implementations of various parts of the lightning protocol are in this module.
2311
2412
#[cfg(any(test, feature = "_test_utils"))]
2513
#[macro_use]

lightning/src/ln/peer_handler.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub struct MessageHandler<CM: Deref, RM: Deref, OM: Deref> where
284284
/// to a remote host. You will need to be able to generate multiple of these which meet Eq and
285285
/// implement Hash to meet the PeerManager API.
286286
///
287-
/// For efficiency, Clone should be relatively cheap for this type.
287+
/// For efficiency, [`Clone`] should be relatively cheap for this type.
288288
///
289289
/// Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
290290
/// has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
@@ -547,10 +547,10 @@ pub type SimpleRefPeerManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm
547547
/// [`PeerManager`] functions related to the same connection must occur only in serial, making new
548548
/// calls only after previous ones have returned.
549549
///
550-
/// Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
551-
/// a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
552-
/// essentially you should default to using a SimpleRefPeerManager, and use a
553-
/// SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
550+
/// Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`]
551+
/// a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but
552+
/// essentially you should default to using a [`SimpleRefPeerManager`], and use a
553+
/// [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when
554554
/// you're using lightning-net-tokio.
555555
///
556556
/// [`read_event`]: PeerManager::read_event
@@ -638,7 +638,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, OM: Deref, L: Deref, NS: Deref> Pe
638638
/// `OnionMessageHandler`. No routing message handler is used and network graph messages are
639639
/// ignored.
640640
///
641-
/// ephemeral_random_data is used to derive per-connection ephemeral keys and must be
641+
/// `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
642642
/// cryptographically secure random bytes.
643643
///
644644
/// `current_time` is used as an always-increasing counter that survives across restarts and is
@@ -670,7 +670,7 @@ impl<Descriptor: SocketDescriptor, RM: Deref, L: Deref, NS: Deref> PeerManager<D
670670
/// timestamp, however if it is not available a persistent counter that increases once per
671671
/// minute should suffice.
672672
///
673-
/// ephemeral_random_data is used to derive per-connection ephemeral keys and must be
673+
/// `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
674674
/// cryptographically secure random bytes.
675675
///
676676
/// (C-not exported) as we can't export a PeerManager with a dummy channel handler
@@ -733,7 +733,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
733733
NS::Target: NodeSigner
734734
{
735735
/// Constructs a new PeerManager with the given message handlers and node_id secret key
736-
/// ephemeral_random_data is used to derive per-connection ephemeral keys and must be
736+
/// `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
737737
/// cryptographically secure random bytes.
738738
///
739739
/// `current_time` is used as an always-increasing counter that survives across restarts and is
@@ -1011,7 +1011,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
10111011
/// May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
10121012
/// returning. Thus, be very careful with reentrancy issues! The invariants around calling
10131013
/// [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
1014-
/// ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
1014+
/// ready to call [`write_buffer_space_avail`] again if a write call generated here isn't
10151015
/// sufficient!
10161016
///
10171017
/// [`send_data`]: SocketDescriptor::send_data

lightning/src/routing/gossip.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<G: Deref<Target=NetworkGraph<L>>, U: Deref, L: Deref> P2PGossipSync<G, U, L
234234
where U::Target: UtxoLookup, L::Target: Logger
235235
{
236236
/// Creates a new tracker of the actual state of the network of channels and nodes,
237-
/// assuming an existing Network Graph.
237+
/// assuming an existing [`NetworkGraph`].
238238
/// UTXO lookup is used to make sure announced channels exist on-chain, channel data is
239239
/// correct, and the announcement is signed with channel owners' keys.
240240
pub fn new(network_graph: G, utxo_lookup: Option<U>, logger: L) -> Self {
@@ -432,14 +432,20 @@ where U::Target: UtxoLookup, L::Target: Logger
432432
}
433433

434434
/// Initiates a stateless sync of routing gossip information with a peer
435-
/// using gossip_queries. The default strategy used by this implementation
435+
/// using [`gossip_queries`]. The default strategy used by this implementation
436436
/// is to sync the full block range with several peers.
437437
///
438-
/// We should expect one or more reply_channel_range messages in response
439-
/// to our query_channel_range. Each reply will enqueue a query_scid message
438+
/// We should expect one or more [`reply_channel_range`] messages in response
439+
/// to our [`query_channel_range`]. Each reply will enqueue a [`query_scid`] message
440440
/// to request gossip messages for each channel. The sync is considered complete
441-
/// when the final reply_scids_end message is received, though we are not
441+
/// when the final [`reply_scids_end`] message is received, though we are not
442442
/// tracking this directly.
443+
///
444+
/// [`gossip_queries`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#query-messages
445+
/// [`reply_channel_range`]: msgs::ReplyChannelRange
446+
/// [`query_channel_range`]: msgs::QueryChannelRange
447+
/// [`query_scid`]: msgs::QueryShortChannelIds
448+
/// [`reply_scids_end`]: msgs::ReplyShortChannelIdsEnd
443449
fn peer_connected(&self, their_node_id: &PublicKey, init_msg: &Init, _inbound: bool) -> Result<(), ()> {
444450
// We will only perform a sync with peers that support gossip_queries.
445451
if !init_msg.features.supports_gossip_queries() {

0 commit comments

Comments
 (0)