Skip to content

Commit a65686c

Browse files
committed
Clarify the contexts in which persist_new_channel may be called
Its somewhat confusing that `persist_new_channel` is called on startup for an existing channel in common deployments, so we call it out explicitly.
1 parent c20f0cf commit a65686c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lightning/src/chain/chainmonitor.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ impl MonitorUpdateId {
9292
/// closed without broadcasting the latest state. See
9393
/// [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
9494
pub trait Persist<ChannelSigner: Sign> {
95-
/// Persist a new channel's data. The data can be stored any way you want, but the identifier
96-
/// provided by LDK is the channel's outpoint (and it is up to you to maintain a correct
97-
/// mapping between the outpoint and the stored channel data). Note that you **must** persist
98-
/// every new monitor to disk.
95+
/// Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
96+
/// called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
97+
///
98+
/// The data can be stored any way you want, but the identifier provided by LDK is the
99+
/// channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
100+
/// and the stored channel data). Note that you **must** persist every new monitor to disk.
99101
///
100102
/// The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
101103
/// if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].

0 commit comments

Comments
 (0)