@@ -1178,6 +1178,25 @@ where
1178
1178
///
1179
1179
/// TODO: Consider re-writing ChannelManagerReadArgs docs and moving here.
1180
1180
///
1181
+ /// # Operation
1182
+ ///
1183
+ /// The following is required for [`ChannelManager`] to function properly:
1184
+ /// - Handle messages from peers using its [`ChannelMessageHandler`] implementation (typically
1185
+ /// called by [`PeerManager::read_event`] when processing network I/O)
1186
+ /// - Send messages to peers obtained via its [`MessageSendEventsProvider`] implementation
1187
+ /// (typically initiated when [`PeerManager::process_events`] is called)
1188
+ /// - Feed on-chain activity using either its [`chain::Listen`] or [`chain::Confirm`] implementation
1189
+ /// as documented by those traits
1190
+ /// - Perform any periodic channel and payment checks by calling [`timer_tick_occurred`] roughly
1191
+ /// every minute
1192
+ /// - Persist to disk whenever [`get_and_clear_needs_persistence`] returns `true` using a
1193
+ /// [`Persister`] such as a [`KVStore`] implementation
1194
+ ///
1195
+ /// The [`lightning-block-sync`] and [`lightning-transaction-sync`] crates provide utilities that
1196
+ /// simplify feeding in on-chain activity using the [`chain::Listen`] and [`chain::Confirm`] traits,
1197
+ /// respectively. The remaining requirements can be met using the [`lightning-background-processor`]
1198
+ /// crate. For languages other than Rust, the availability of similar utilities may vary.
1199
+ ///
1181
1200
/// # Persistence
1182
1201
///
1183
1202
/// Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
@@ -1227,13 +1246,21 @@ where
1227
1246
/// you're using lightning-net-tokio.
1228
1247
///
1229
1248
/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
1249
+ /// [`PeerManager::read_event`]: crate::ln::peer_handler::PeerManager::read_event
1250
+ /// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
1251
+ /// [`timer_tick_occurred`]: Self::timer_tick_occurred
1252
+ /// [`get_and_clear_needs_persistence`]: Self::get_and_clear_needs_persistence
1253
+ /// [`Persister`]: crate::util::persist::Persister
1254
+ /// [`KVStore`]: crate::util::persist::KVStore
1255
+ /// [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync
1256
+ /// [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync
1257
+ /// [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor
1230
1258
/// [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
1231
1259
/// [`funding_created`]: msgs::FundingCreated
1232
1260
/// [`funding_transaction_generated`]: Self::funding_transaction_generated
1233
1261
/// [`BlockHash`]: bitcoin::hash_types::BlockHash
1234
1262
/// [`update_channel`]: chain::Watch::update_channel
1235
1263
/// [`ChannelUpdate`]: msgs::ChannelUpdate
1236
- /// [`timer_tick_occurred`]: Self::timer_tick_occurred
1237
1264
/// [`read`]: ReadableArgs::read
1238
1265
//
1239
1266
// Lock order:
@@ -8648,6 +8675,9 @@ where
8648
8675
}
8649
8676
8650
8677
/// Returns true if this [`ChannelManager`] needs to be persisted.
8678
+ ///
8679
+ /// See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that
8680
+ /// indicates this should be checked.
8651
8681
pub fn get_and_clear_needs_persistence(&self) -> bool {
8652
8682
self.needs_persist_flag.swap(false, Ordering::AcqRel)
8653
8683
}
0 commit comments