@@ -183,6 +183,10 @@ impl Readable for ChannelMonitorUpdate {
183183 }
184184}
185185
186+ fn push_monitor_event ( pending_monitor_events : & mut Vec < MonitorEvent > , event : MonitorEvent ) {
187+ pending_monitor_events. push ( event) ;
188+ }
189+
186190/// An event to be processed by the ChannelManager.
187191#[ derive( Clone , PartialEq , Eq ) ]
188192pub enum MonitorEvent {
@@ -226,8 +230,6 @@ pub enum MonitorEvent {
226230 } ,
227231}
228232impl_writeable_tlv_based_enum_upgradable_legacy ! ( MonitorEvent ,
229- // Note that Completed is currently never serialized to disk as it is generated only in
230- // ChainMonitor.
231233 ( 0 , Completed ) => {
232234 ( 0 , funding_txo, required) ,
233235 ( 2 , monitor_update_id, required) ,
@@ -2166,6 +2168,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
21662168 self . inner . lock ( ) . unwrap ( ) . get_and_clear_pending_monitor_events ( )
21672169 }
21682170
2171+ pub ( super ) fn push_monitor_event ( & self , event : MonitorEvent ) {
2172+ self . inner . lock ( ) . unwrap ( ) . push_monitor_event ( event) ;
2173+ }
2174+
21692175 /// Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
21702176 ///
21712177 /// For channels featuring anchor outputs, this method will also process [`BumpTransaction`]
@@ -3891,7 +3897,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
38913897 outpoint : funding_outpoint,
38923898 channel_id : self . channel_id ,
38933899 } ;
3894- self . pending_monitor_events . push ( event) ;
3900+ push_monitor_event ( & mut self . pending_monitor_events , event) ;
38953901 }
38963902
38973903 // Although we aren't signing the transaction directly here, the transaction will be signed
@@ -4552,6 +4558,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45524558 & self . outputs_to_watch
45534559 }
45544560
4561+ fn push_monitor_event ( & mut self , event : MonitorEvent ) {
4562+ push_monitor_event ( & mut self . pending_monitor_events , event) ;
4563+ }
4564+
45554565 fn get_and_clear_pending_monitor_events ( & mut self ) -> Vec < MonitorEvent > {
45564566 let mut ret = Vec :: new ( ) ;
45574567 mem:: swap ( & mut ret, & mut self . pending_monitor_events ) ;
@@ -5611,7 +5621,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
56115621 ) ;
56125622 log_info ! ( logger, "Channel closed by funding output spend in txid {txid}" ) ;
56135623 if !self . funding_spend_seen {
5614- self . pending_monitor_events . push ( MonitorEvent :: CommitmentTxConfirmed ( ( ) ) ) ;
5624+ self . push_monitor_event ( MonitorEvent :: CommitmentTxConfirmed ( ( ) ) ) ;
56155625 }
56165626 self . funding_spend_seen = true ;
56175627
@@ -5786,7 +5796,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
57865796
57875797 log_debug ! ( logger, "HTLC {} failure update in {} has got enough confirmations to be passed upstream" ,
57885798 & payment_hash, entry. txid) ;
5789- self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
5799+ self . push_monitor_event ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
57905800 payment_hash,
57915801 payment_preimage : None ,
57925802 source,
@@ -5896,7 +5906,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
58965906 log_error ! ( logger, "Failing back HTLC {} upstream to preserve the \
58975907 channel as the forward HTLC hasn't resolved and our backward HTLC \
58985908 expires soon at {}", log_bytes!( htlc. payment_hash. 0 ) , inbound_htlc_expiry) ;
5899- self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
5909+ push_monitor_event ( & mut self . pending_monitor_events , MonitorEvent :: HTLCEvent ( HTLCUpdate {
59005910 source : source. clone ( ) ,
59015911 payment_preimage : None ,
59025912 payment_hash : htlc. payment_hash ,
@@ -6313,7 +6323,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
63136323 } ,
63146324 } ) ;
63156325 self . counterparty_fulfilled_htlcs . insert ( SentHTLCId :: from_source ( & source) , payment_preimage) ;
6316- self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
6326+ push_monitor_event ( & mut self . pending_monitor_events , MonitorEvent :: HTLCEvent ( HTLCUpdate {
63176327 source,
63186328 payment_preimage : Some ( payment_preimage) ,
63196329 payment_hash,
@@ -6337,7 +6347,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
63376347 } ,
63386348 } ) ;
63396349 self . counterparty_fulfilled_htlcs . insert ( SentHTLCId :: from_source ( & source) , payment_preimage) ;
6340- self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
6350+ push_monitor_event ( & mut self . pending_monitor_events , MonitorEvent :: HTLCEvent ( HTLCUpdate {
63416351 source,
63426352 payment_preimage : Some ( payment_preimage) ,
63436353 payment_hash,
0 commit comments