@@ -194,7 +194,7 @@ fn push_monitor_event(
194194}
195195
196196/// An event to be processed by the ChannelManager.
197- #[ derive( Clone , PartialEq , Eq ) ]
197+ #[ derive( Clone , PartialEq , Eq , Debug ) ]
198198pub enum MonitorEvent {
199199 /// A monitor event containing an HTLCUpdate.
200200 HTLCEvent ( HTLCUpdate ) ,
@@ -256,7 +256,7 @@ impl_writeable_tlv_based_enum_upgradable_legacy!(MonitorEvent,
256256/// Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
257257/// chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
258258/// preimage claim backward will lead to loss of funds.
259- #[ derive( Clone , PartialEq , Eq ) ]
259+ #[ derive( Clone , PartialEq , Eq , Debug ) ]
260260pub struct HTLCUpdate {
261261 pub ( crate ) payment_hash : PaymentHash ,
262262 pub ( crate ) payment_preimage : Option < PaymentPreimage > ,
@@ -2272,6 +2272,16 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
22722272 self_inner. next_monitor_event_id = next_id;
22732273 }
22742274
2275+ /// Used by test infra to check for monitor event leaks at the end of a test.
2276+ #[ cfg( any( test, feature = "_test_utils" ) ) ]
2277+ pub fn drain_unacked_monitor_events ( & self ) -> Vec < ( u64 , MonitorEvent ) > {
2278+ let mut inner = self . inner . lock ( ) . unwrap ( ) ;
2279+ let mut events = Vec :: new ( ) ;
2280+ events. append ( & mut inner. pending_monitor_events ) ;
2281+ events. append ( & mut inner. provided_monitor_events ) ;
2282+ events
2283+ }
2284+
22752285 /// Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
22762286 ///
22772287 /// For channels featuring anchor outputs, this method will also process [`BumpTransaction`]
0 commit comments