File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -680,10 +680,10 @@ impl Node {
680680 log_debug ! ( self . logger, "Stopped chain sources." ) ;
681681
682682 // Wait until all background tasks (mod LDK's background processor) are done.
683- let runtime_handle = runtime . handle ( ) ;
683+ let runtime_2 = Arc :: clone ( & runtime ) ;
684684 if let Some ( mut tasks) = self . background_tasks . lock ( ) . unwrap ( ) . take ( ) {
685685 tokio:: task:: block_in_place ( move || {
686- runtime_handle . block_on ( async {
686+ runtime_2 . block_on ( async {
687687 loop {
688688 let timeout_fut = tokio:: time:: timeout (
689689 Duration :: from_secs ( BACKGROUND_TASK_SHUTDOWN_TIMEOUT_SECS ) ,
@@ -721,10 +721,9 @@ impl Node {
721721 if let Some ( background_processor_task) =
722722 self . background_processor_task . lock ( ) . unwrap ( ) . take ( )
723723 {
724- let runtime_handle = runtime. handle ( ) ;
725724 let abort_handle = background_processor_task. abort_handle ( ) ;
726725 let timeout_res = tokio:: task:: block_in_place ( move || {
727- runtime_handle . block_on ( async {
726+ runtime . block_on ( async {
728727 tokio:: time:: timeout (
729728 Duration :: from_secs ( LDK_EVENT_HANDLER_SHUTDOWN_TIMEOUT_SECS ) ,
730729 background_processor_task,
Original file line number Diff line number Diff line change @@ -1381,3 +1381,14 @@ fn facade_logging() {
13811381 validate_log_entry ( entry) ;
13821382 }
13831383}
1384+
1385+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
1386+ async fn drop_in_async_context ( ) {
1387+ let ( _bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1388+ let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1389+ let seed_bytes = vec ! [ 42u8 ; 64 ] ;
1390+
1391+ let config = random_config ( true ) ;
1392+ let node = setup_node ( & chain_source, config, Some ( seed_bytes) ) ;
1393+ node. stop ( ) . unwrap ( ) ;
1394+ }
You can’t perform that action at this time.
0 commit comments