File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
lightning-background-processor/src Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -976,11 +976,19 @@ impl BackgroundProcessor {
976
976
scorer,
977
977
stop_thread. load( Ordering :: Acquire ) ,
978
978
{
979
- Sleeper :: from_two_futures(
980
- & channel_manager. get_cm( ) . get_event_or_persistence_needed_future( ) ,
981
- & chain_monitor. get_update_future( ) ,
982
- )
983
- . wait_timeout( Duration :: from_millis( 100 ) ) ;
979
+ let sleeper = if let Some ( om) = onion_messenger. as_ref( ) {
980
+ Sleeper :: from_three_futures(
981
+ & channel_manager. get_cm( ) . get_event_or_persistence_needed_future( ) ,
982
+ & chain_monitor. get_update_future( ) ,
983
+ & om. get_om( ) . get_update_future( ) ,
984
+ )
985
+ } else {
986
+ Sleeper :: from_two_futures(
987
+ & channel_manager. get_cm( ) . get_event_or_persistence_needed_future( ) ,
988
+ & chain_monitor. get_update_future( ) ,
989
+ )
990
+ } ;
991
+ sleeper. wait_timeout( Duration :: from_millis( 100 ) ) ;
984
992
} ,
985
993
|_| Instant :: now( ) ,
986
994
|time: & Instant , dur| time. elapsed( ) . as_secs( ) > dur,
Original file line number Diff line number Diff line change @@ -244,10 +244,20 @@ impl Sleeper {
244
244
Self { notifiers : vec ! [ Arc :: clone( & future. state) ] }
245
245
}
246
246
/// Constructs a new sleeper from two futures, allowing blocking on both at once.
247
- // Note that this is the common case - a ChannelManager and ChainMonitor.
248
247
pub fn from_two_futures ( fut_a : & Future , fut_b : & Future ) -> Self {
249
248
Self { notifiers : vec ! [ Arc :: clone( & fut_a. state) , Arc :: clone( & fut_b. state) ] }
250
249
}
250
+ /// Constructs a new sleeper from three futures, allowing blocking on both at once.
251
+ // Note that this is the common case - a ChannelManager, a ChainMonitor, and an
252
+ // OnionMessenger.
253
+ pub fn from_three_futures ( fut_a : & Future , fut_b : & Future , fut_c : & Future ) -> Self {
254
+ let notifiers = vec ! [
255
+ Arc :: clone( & fut_a. state) ,
256
+ Arc :: clone( & fut_b. state) ,
257
+ Arc :: clone( & fut_c. state)
258
+ ] ;
259
+ Self { notifiers }
260
+ }
251
261
/// Constructs a new sleeper on many futures, allowing blocking on all at once.
252
262
pub fn new ( futures : Vec < Future > ) -> Self {
253
263
Self { notifiers : futures. into_iter ( ) . map ( |f| Arc :: clone ( & f. state ) ) . collect ( ) }
You can’t perform that action at this time.
0 commit comments