@@ -707,6 +707,7 @@ impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> even
707
707
L :: Target : Logger ,
708
708
P :: Target : Persist < ChannelSigner > ,
709
709
{
710
+ #[ cfg( not( anchors) ) ]
710
711
/// Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
711
712
///
712
713
/// An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in
@@ -722,6 +723,29 @@ impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> even
722
723
handler. handle_event ( & event) ;
723
724
}
724
725
}
726
+ #[ cfg( anchors) ]
727
+ /// Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
728
+ ///
729
+ /// For channels featuring anchor outputs, this method will also process [`BumpTransaction`]
730
+ /// events produced from each [`ChannelMonitor`] while there is a balance to claim onchain
731
+ /// within each channel. As the confirmation of a commitment transaction may be critical to the
732
+ /// safety of funds, this method must be invoked frequently, ideally once for every chain tip
733
+ /// update (block connected or disconnected).
734
+ ///
735
+ /// An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in
736
+ /// order to handle these events.
737
+ ///
738
+ /// [`SpendableOutputs`]: events::Event::SpendableOutputs
739
+ /// [`BumpTransaction`]: events::Event::BumpTransaction
740
+ fn process_pending_events < H : Deref > ( & self , handler : H ) where H :: Target : EventHandler {
741
+ let mut pending_events = Vec :: new ( ) ;
742
+ for monitor_state in self . monitors . read ( ) . unwrap ( ) . values ( ) {
743
+ pending_events. append ( & mut monitor_state. monitor . get_and_clear_pending_events ( ) ) ;
744
+ }
745
+ for event in pending_events. drain ( ..) {
746
+ handler. handle_event ( & event) ;
747
+ }
748
+ }
725
749
}
726
750
727
751
#[ cfg( test) ]
0 commit comments