Skip to content

Commit 54bf98c

Browse files
committed
f much better docs, and missing udpate
1 parent 7cae27a commit 54bf98c

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
@@ -498,8 +498,9 @@ struct ClaimablePayments {
498498
}
499499

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

0 commit comments

Comments
 (0)