Skip to content

Commit 8997d94

Browse files
committed
Contrast ChannelManager and ChannelMonitor in docs
1 parent 6ef2021 commit 8997d94

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,22 @@ where
11351135
/// Thus, [`ChannelManager`] is typically used to parameterize a [`MessageHandler`] and an
11361136
/// [`OnionMessenger`]. The latter is required to support BOLT 12 functionality.
11371137
///
1138+
/// # `ChannelManager` vs `ChannelMonitor`
1139+
///
1140+
/// It's important to distinguish between the *off-chain* management and *on-chain* enforcement of
1141+
/// lightning channels. [`ChannelManager`] exchanges messages with peers to manage the off-chain
1142+
/// state of each channel. During this process, it generates a [`ChannelMonitor`] for each channel
1143+
/// and a [`ChannelMonitorUpdate`] for each relevant change, notifying its parameterized
1144+
/// [`chain::Watch`] of them.
1145+
///
1146+
/// An implementation of [`chain::Watch`], such as [`ChainMonitor`], is responsible for aggregating
1147+
/// these [`ChannelMonitor`]s and applying any [`ChannelMonitorUpdate`]s to them. It then monitors
1148+
/// for any pertinent on-chain activity, enforcing claims as needed.
1149+
///
1150+
/// This division of off-chain management and on-chain enforcement allows for interesting node
1151+
/// setups. For instance, on-chain enforcement could be moved to a separate host or have added
1152+
/// redundancy, possibly as a watchtower. See [`chain::Watch`] for the relevant interface.
1153+
///
11381154
/// # Persistence
11391155
///
11401156
/// Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for

0 commit comments

Comments
 (0)