Skip to content

Commit 16e222c

Browse files
committed
f much better docs, and missing udpate
1 parent 391d09e commit 16e222c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,9 @@ struct ClaimablePayments {
496496
}
497497

498498
/// Events which we process internally but cannot be procsesed immediately at the generation site
499-
/// for some reason. They are handled in timer_tick_occurred, so may be processed with
500-
/// quite some time lag.
499+
/// usually because we're running pre-full-init. They are handled immediately once we detect we are
500+
/// running normally, and specifically must be processed before any other non-background
501+
/// [`ChannelMonitorUpdate`]s are applied.
501502
enum BackgroundEvent {
502503
/// Handle a ChannelMonitorUpdate which closes the channel. This is only separated from
503504
/// [`Self::MonitorUpdateRegeneratedOnStartup`] as the maybe-non-closing variant needs a public
@@ -982,6 +983,15 @@ where
982983
pending_events: Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
983984
/// A simple atomic flag to ensure only one task at a time can be processing events asynchronously.
984985
pending_events_processor: AtomicBool,
986+
987+
/// If we are running during init (either directly during the dserialization method or in block
988+
/// connection methods which run after deserialization but before normal operation) we cannot
989+
/// provide the user with [`ChannelMonitorUpdate`]s through the normal update flow - prior to
990+
/// normal operation the user may not have loaded the [`ChannelMonitor`]s into their
991+
/// [`ChainMonitor`] and thus attempting to update it will fail or panic.
992+
///
993+
/// Thus, we place them here to be handled as soon as possible once we are running normally.
994+
///
985995
/// See `ChannelManager` struct-level documentation for lock order requirements.
986996
pending_background_events: Mutex<Vec<BackgroundEvent>>,
987997
/// Used when we have to take a BIG lock to make sure everything is self-consistent.

0 commit comments

Comments
 (0)