Skip to content

Commit d3de06b

Browse files
committed
Contrast ChannelManager and ChannelMonitor in docs
1 parent 2d06e1e commit d3de06b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,21 @@ where
10911091
/// Additionally, [`ChannelManager`] implements both [`chain::Listen`] and [`chain::Confirm`] for
10921092
/// notification of on-chain activity.
10931093
///
1094+
/// # `ChannelManager` vs `ChannelMonitor`
1095+
///
1096+
/// It's important to distinguish between the *off-chain* management and *on-chain* monitoring of
1097+
/// lightning channels. [`ChannelManager`] exchanges messages with peers to manage the off-chain
1098+
/// state of each channel. During this process, it generates a [`ChannelMonitor`] for each channel
1099+
/// and a [`ChannelMonitorUpdate`] for each relevant change, notifying its parameterized
1100+
/// [`chain::Watch`] of them.
1101+
///
1102+
/// An implementation of [`chain::Watch`], such as [`ChainMonitor`], is responsible for aggregating
1103+
/// these [`ChannelMonitor`]s and applying any [`ChannelMonitorUpdate`]s to them. It then monitors
1104+
/// for any pertinent on-chain activity, broadcasting claims as needed.
1105+
///
1106+
/// This division of off-chain management and on-chain monitoring is what allows for interesting
1107+
/// node setups. See the [`chain`] module for further details.
1108+
///
10941109
/// # Persistence
10951110
///
10961111
/// Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for

0 commit comments

Comments
 (0)