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 {
602602 }
603603}
604604#[ cfg( feature = "futures" ) ]
605- use core:: task;
605+ use core:: { task, future :: Future } ;
606606#[ cfg( feature = "futures" ) ]
607607use futures_util:: { dummy_waker, OptionalSelector , Selector , SelectorOutput } ;
608608
@@ -992,6 +992,22 @@ impl BackgroundProcessor {
992992 }
993993 event_handler. handle_event ( event)
994994 } ;
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+ } ;
9951011 define_run_body ! (
9961012 persister,
9971013 chain_monitor,
@@ -1004,7 +1020,7 @@ impl BackgroundProcessor {
10041020 } ,
10051021 peer_manager,
10061022 gossip_sync,
1007- sweeper ,
1023+ sweeper_handler ,
10081024 logger,
10091025 scorer,
10101026 stop_thread. load( Ordering :: Acquire ) ,
You can’t perform that action at this time.
0 commit comments