File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
lightning-background-processor/src Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ pub(crate) mod futures_util {
602
602
}
603
603
}
604
604
#[ cfg( feature = "futures" ) ]
605
- use core:: task;
605
+ use core:: { task, future :: Future } ;
606
606
#[ cfg( feature = "futures" ) ]
607
607
use futures_util:: { dummy_waker, OptionalSelector , Selector , SelectorOutput } ;
608
608
@@ -992,6 +992,22 @@ impl BackgroundProcessor {
992
992
}
993
993
event_handler. handle_event ( event)
994
994
} ;
995
+ let sweeper_handler = || {
996
+ let mut fut = Box :: pin ( sweeper. regenerate_and_broadcast_spend_if_necessary_locked ( ) ) ;
997
+ let mut waker = dummy_waker ( ) ;
998
+ let mut ctx = task:: Context :: from_waker ( & mut waker) ;
999
+ match fut. as_mut ( ) . poll ( & mut ctx) {
1000
+ task:: Poll :: Ready ( result) => {
1001
+ if let Err ( _) = result {
1002
+ log_error ! ( logger, "Failed to sweep output" )
1003
+ }
1004
+ } ,
1005
+ task:: Poll :: Pending => {
1006
+ // In a sync context, we can't wait for the future to complete.
1007
+ debug_assert ! ( false ) ;
1008
+ } ,
1009
+ }
1010
+ } ;
995
1011
define_run_body ! (
996
1012
persister,
997
1013
chain_monitor,
@@ -1004,7 +1020,7 @@ impl BackgroundProcessor {
1004
1020
} ,
1005
1021
peer_manager,
1006
1022
gossip_sync,
1007
- sweeper ,
1023
+ sweeper_handler ,
1008
1024
logger,
1009
1025
scorer,
1010
1026
stop_thread. load( Ordering :: Acquire ) ,
You can’t perform that action at this time.
0 commit comments