Skip to content

Commit ccac948

Browse files
committed
f - Touch up chainmonitor docs based on review feedback
1 parent f98bbff commit ccac948

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

lightning/src/chain/chainmonitor.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99

1010
//! Logic to connect off-chain channel management with on-chain transaction monitoring.
1111
//!
12-
//! [`ChainMonitor`] is a simple implementation of [`chain::Watch`] used both to process blocks and
13-
//! to update on-chain [`ChannelMonitor`]s accordingly. If any on-chain events need further
14-
//! processing, it will make those available as [`MonitorEvent`]s to be consumed.
12+
//! [`ChainMonitor`] is an implementation of [`chain::Watch`] used both to process blocks and to
13+
//! update [`ChannelMonitor`]s accordingly. If any on-chain events need further processing, it will
14+
//! make those available as [`MonitorEvent`]s to be consumed.
15+
//!
16+
//! `ChainMonitor` is parameterized by an optional chain source, which must implement the
17+
//! [`chain::Filter`] trait. This provides a mechanism to signal new relevant outputs back to light
18+
//! clients, such that transactions spending those outputs are included in block data.
1519
//!
1620
//! `ChainMonitor` may be used directly to monitor channels locally or as a part of a distributed
1721
//! setup to monitor channels remotely. In the latter case, a custom `chain::Watch` implementation
@@ -20,6 +24,7 @@
2024
//! servicing `ChannelMonitor` updates from the client.
2125
//!
2226
//! [`ChainMonitor`]: struct.ChainMonitor.html
27+
//! [`chain::Filter`]: ../trait.Filter.html
2328
//! [`chain::Watch`]: ../trait.Watch.html
2429
//! [`ChannelMonitor`]: ../channelmonitor/struct.ChannelMonitor.html
2530
//! [`MonitorEvent`]: ../channelmonitor/enum.MonitorEvent.html
@@ -44,10 +49,12 @@ use std::ops::Deref;
4449
///
4550
/// Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
4651
/// [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
47-
/// or used independently to monitor channels remotely.
52+
/// or used independently to monitor channels remotely. See the [module-level documentation] for
53+
/// details.
4854
///
4955
/// [`chain::Watch`]: ../trait.Watch.html
5056
/// [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
57+
/// [module-level documentation]: index.html
5158
pub struct ChainMonitor<ChanSigner: ChannelKeys, C: Deref, T: Deref, F: Deref, L: Deref>
5259
where C::Target: chain::Filter,
5360
T::Target: BroadcasterInterface,
@@ -75,7 +82,7 @@ impl<ChanSigner: ChannelKeys, C: Deref, T: Deref, F: Deref, L: Deref> ChainMonit
7582
///
7683
/// Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch, returning
7784
/// `true` if so. In this case, if providing pre-filtered blocks, the caller should re-fetch the
78-
/// block to obtain updated `txdata` and recall `block_connected`.
85+
/// block to obtain updated `txdata` and re-call `block_connected`.
7986
///
8087
/// [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
8188
/// [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
@@ -131,7 +138,7 @@ impl<ChanSigner: ChannelKeys, C: Deref, T: Deref, F: Deref, L: Deref> ChainMonit
131138
}
132139
}
133140

134-
/// Adds or updates the monitor which monitors the channel referred to by the given outpoint.
141+
/// Adds the monitor that watches the channel referred to by the given outpoint.
135142
///
136143
/// Calls back to [`chain::Filter`] with the funding transaction and outputs to watch.
137144
///
@@ -159,7 +166,7 @@ impl<ChanSigner: ChannelKeys, C: Deref, T: Deref, F: Deref, L: Deref> ChainMonit
159166
Ok(())
160167
}
161168

162-
/// Updates the monitor which monitors the channel referred to by the given outpoint.
169+
/// Updates the monitor that watches the channel referred to by the given outpoint.
163170
fn update_monitor(&self, outpoint: OutPoint, update: ChannelMonitorUpdate) -> Result<(), MonitorUpdateError> {
164171
let mut monitors = self.monitors.lock().unwrap();
165172
match monitors.get_mut(&outpoint) {

0 commit comments

Comments
 (0)