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 {
680
680
log_debug ! ( self . logger, "Stopped chain sources." ) ;
681
681
682
682
// 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 ) ;
684
684
if let Some ( mut tasks) = self . background_tasks . lock ( ) . unwrap ( ) . take ( ) {
685
685
tokio:: task:: block_in_place ( move || {
686
- runtime_handle . block_on ( async {
686
+ runtime_2 . block_on ( async {
687
687
loop {
688
688
let timeout_fut = tokio:: time:: timeout (
689
689
Duration :: from_secs ( BACKGROUND_TASK_SHUTDOWN_TIMEOUT_SECS ) ,
@@ -721,10 +721,9 @@ impl Node {
721
721
if let Some ( background_processor_task) =
722
722
self . background_processor_task . lock ( ) . unwrap ( ) . take ( )
723
723
{
724
- let runtime_handle = runtime. handle ( ) ;
725
724
let abort_handle = background_processor_task. abort_handle ( ) ;
726
725
let timeout_res = tokio:: task:: block_in_place ( move || {
727
- runtime_handle . block_on ( async {
726
+ runtime . block_on ( async {
728
727
tokio:: time:: timeout (
729
728
Duration :: from_secs ( LDK_EVENT_HANDLER_SHUTDOWN_TIMEOUT_SECS ) ,
730
729
background_processor_task,
Original file line number Diff line number Diff line change @@ -1381,3 +1381,14 @@ fn facade_logging() {
1381
1381
validate_log_entry ( entry) ;
1382
1382
}
1383
1383
}
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