Skip to content

Commit 9ce7e8e

Browse files
committed
Rename ClosingMonitorUpdateRegeneratedOnStartup to Closed...
Now that we also use the "Closing" `BackgroundEvent` for already-closed channels we need to rename it and tweak the docs.
1 parent 345f8df commit 9ce7e8e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lightning/src/ln/channelmanager.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -507,19 +507,19 @@ struct ClaimablePayments {
507507
/// running normally, and specifically must be processed before any other non-background
508508
/// [`ChannelMonitorUpdate`]s are applied.
509509
enum BackgroundEvent {
510-
/// Handle a ChannelMonitorUpdate which closes the channel. This is only separated from
511-
/// [`Self::MonitorUpdateRegeneratedOnStartup`] as the maybe-non-closing variant needs a public
512-
/// key to handle channel resumption, whereas if the channel has been force-closed we do not
513-
/// need the counterparty node_id.
510+
/// Handle a ChannelMonitorUpdate which closes the channel or for an already-closed channel.
511+
/// This is only separated from [`Self::MonitorUpdateRegeneratedOnStartup`] as the
512+
/// maybe-non-closing variant needs a public key to handle channel resumption, whereas if the
513+
/// channel has been force-closed we do not need the counterparty node_id.
514514
///
515515
/// Note that any such events are lost on shutdown, so in general they must be updates which
516516
/// are regenerated on startup.
517-
ClosingMonitorUpdateRegeneratedOnStartup((OutPoint, ChannelMonitorUpdate)),
517+
ClosedMonitorUpdateRegeneratedOnStartup((OutPoint, ChannelMonitorUpdate)),
518518
/// Handle a ChannelMonitorUpdate which may or may not close the channel and may unblock the
519519
/// channel to continue normal operation.
520520
///
521521
/// In general this should be used rather than
522-
/// [`Self::ClosingMonitorUpdateRegeneratedOnStartup`], however in cases where the
522+
/// [`Self::ClosedMonitorUpdateRegeneratedOnStartup`], however in cases where the
523523
/// `counterparty_node_id` is not available as the channel has closed from a [`ChannelMonitor`]
524524
/// error the other variant is acceptable.
525525
///
@@ -4103,7 +4103,7 @@ where
41034103

41044104
for event in background_events.drain(..) {
41054105
match event {
4106-
BackgroundEvent::ClosingMonitorUpdateRegeneratedOnStartup((funding_txo, update)) => {
4106+
BackgroundEvent::ClosedMonitorUpdateRegeneratedOnStartup((funding_txo, update)) => {
41074107
// The channel has already been closed, so no use bothering to care about the
41084108
// monitor updating completing.
41094109
let _ = self.chain_monitor.update_channel(funding_txo, &update);
@@ -4763,15 +4763,15 @@ where
47634763
// If we're running during init we cannot update a monitor directly - they probably
47644764
// haven't actually been loaded yet. Instead, push the monitor update as a background
47654765
// event.
4766-
// Note that while its safe to use `ClosingMonitorUpdateRegeneratedOnStartup` here (the
4766+
// Note that while it's safe to use `ClosedMonitorUpdateRegeneratedOnStartup` here (the
47674767
// channel is already closed) we need to ultimately handle the monitor update
47684768
// completion action only after we've completed the monitor update. This is the only
47694769
// way to guarantee this update *will* be regenerated on startup (otherwise if this was
47704770
// from a forwarded HTLC the downstream preimage may be deleted before we claim
47714771
// upstream). Thus, we need to transition to some new `BackgroundEvent` type which will
47724772
// complete the monitor update completion action from `completion_action`.
47734773
self.pending_background_events.lock().unwrap().push(
4774-
BackgroundEvent::ClosingMonitorUpdateRegeneratedOnStartup((
4774+
BackgroundEvent::ClosedMonitorUpdateRegeneratedOnStartup((
47754775
prev_hop.outpoint, preimage_update,
47764776
)));
47774777
}
@@ -8262,7 +8262,7 @@ where
82628262
update_id: CLOSED_CHANNEL_UPDATE_ID,
82638263
updates: vec![ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast: true }],
82648264
};
8265-
close_background_events.push(BackgroundEvent::ClosingMonitorUpdateRegeneratedOnStartup((*funding_txo, monitor_update)));
8265+
close_background_events.push(BackgroundEvent::ClosedMonitorUpdateRegeneratedOnStartup((*funding_txo, monitor_update)));
82668266
}
82678267
}
82688268

0 commit comments

Comments
 (0)