@@ -501,9 +501,11 @@ struct ClaimablePayments {
501
501
/// for some reason. They are handled in timer_tick_occurred, so may be processed with
502
502
/// quite some time lag.
503
503
enum BackgroundEvent {
504
- /// Handle a ChannelMonitorUpdate that closes a channel, broadcasting its current latest holder
505
- /// commitment transaction.
506
- ClosingMonitorUpdate ( ( OutPoint , ChannelMonitorUpdate ) ) ,
504
+ /// Handle a ChannelMonitorUpdate
505
+ ///
506
+ /// Note that any such events are lost on shutdown, so in general they must be updates which
507
+ /// are regenerated on startup.
508
+ MonitorUpdateRegeneratedOnStartup ( ( OutPoint , ChannelMonitorUpdate ) ) ,
507
509
}
508
510
509
511
#[ derive( Debug ) ]
@@ -3774,7 +3776,7 @@ where
3774
3776
3775
3777
for event in background_events. drain ( ..) {
3776
3778
match event {
3777
- BackgroundEvent :: ClosingMonitorUpdate ( ( funding_txo, update) ) => {
3779
+ BackgroundEvent :: MonitorUpdateRegeneratedOnStartup ( ( funding_txo, update) ) => {
3778
3780
// The channel has already been closed, so no use bothering to care about the
3779
3781
// monitor updating completing.
3780
3782
let _ = self . chain_monitor . update_channel ( funding_txo, & update) ;
@@ -5694,7 +5696,7 @@ where
5694
5696
if let ChannelMonitorUpdateStep :: ChannelForceClosed { should_broadcast } = update. updates [ 0 ] {
5695
5697
assert ! ( should_broadcast) ;
5696
5698
} else { unreachable ! ( ) ; }
5697
- self . pending_background_events . lock ( ) . unwrap ( ) . push ( BackgroundEvent :: ClosingMonitorUpdate ( ( funding_txo, update) ) ) ;
5699
+ self . pending_background_events . lock ( ) . unwrap ( ) . push ( BackgroundEvent :: MonitorUpdateRegeneratedOnStartup ( ( funding_txo, update) ) ) ;
5698
5700
}
5699
5701
self . finish_force_close_channel ( failure) ;
5700
5702
}
@@ -7449,10 +7451,10 @@ where
7449
7451
}
7450
7452
7451
7453
// LDK versions prior to 0.0.116 wrote the `pending_background_events`
7452
- // `ClosingMonitorUpdate `s here, however there was never a reason to do so - the closing
7453
- // monitor updates were always effectively replayed on startup (either directly by calling
7454
- // `broadcast_latest_holder_commitment_txn` on a `ChannelMonitor` during deserialization
7455
- // or, in 0.0.115, by regenerating the monitor update itself).
7454
+ // `MonitorUpdateRegeneratedOnStartup `s here, however there was never a reason to do so -
7455
+ // the closing monitor updates were always effectively replayed on startup (either directly
7456
+ // by calling `broadcast_latest_holder_commitment_txn` on a `ChannelMonitor` during
7457
+ // deserialization or, in 0.0.115, by regenerating the monitor update itself).
7456
7458
0u64 . write ( writer) ?;
7457
7459
7458
7460
// Prior to 0.0.111 we tracked node_announcement serials here, however that now happens in
@@ -7768,7 +7770,7 @@ where
7768
7770
log_bytes!( channel. channel_id( ) ) , monitor. get_latest_update_id( ) , channel. get_latest_monitor_update_id( ) ) ;
7769
7771
let ( monitor_update, mut new_failed_htlcs) = channel. force_shutdown ( true ) ;
7770
7772
if let Some ( monitor_update) = monitor_update {
7771
- pending_background_events. push ( BackgroundEvent :: ClosingMonitorUpdate ( monitor_update) ) ;
7773
+ pending_background_events. push ( BackgroundEvent :: MonitorUpdateRegeneratedOnStartup ( monitor_update) ) ;
7772
7774
}
7773
7775
failed_htlcs. append ( & mut new_failed_htlcs) ;
7774
7776
channel_closures. push_back ( ( events:: Event :: ChannelClosed {
@@ -7843,7 +7845,7 @@ where
7843
7845
update_id : CLOSED_CHANNEL_UPDATE_ID ,
7844
7846
updates : vec ! [ ChannelMonitorUpdateStep :: ChannelForceClosed { should_broadcast: true } ] ,
7845
7847
} ;
7846
- pending_background_events. push ( BackgroundEvent :: ClosingMonitorUpdate ( ( * funding_txo, monitor_update) ) ) ;
7848
+ pending_background_events. push ( BackgroundEvent :: MonitorUpdateRegeneratedOnStartup ( ( * funding_txo, monitor_update) ) ) ;
7847
7849
}
7848
7850
}
7849
7851
@@ -7900,7 +7902,7 @@ where
7900
7902
for _ in 0 ..background_event_count {
7901
7903
match <u8 as Readable >:: read ( reader) ? {
7902
7904
0 => {
7903
- // LDK versions prior to 0.0.116 wrote pending `ClosingMonitorUpdate `s here,
7905
+ // LDK versions prior to 0.0.116 wrote pending `MonitorUpdateRegeneratedOnStartup `s here,
7904
7906
// however we really don't (and never did) need them - we regenerate all
7905
7907
// on-startup monitor updates.
7906
7908
let _: OutPoint = Readable :: read ( reader) ?;
0 commit comments