From 52828d12e44ae821d05bf3de318a7a9692165eaa Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 15 Aug 2023 12:02:12 +0200 Subject: [PATCH] Have `sync_wallets` use a multi-threaded runtime As part of the `OuputSweeper` we broadcast in the `Confirm` implementations, i.e., this would be called during transaction syncing. Since our broadcasting happens async but via the intermediate blocking `BroadcasterInterface` we have to transition from `sync_wallets` (blocking) -> LDK/BDK wallet sync (async) -> Confirm (blocking) -> BroadcasterInterface (blocking) -> bdk::Wallet::broadcast (async). However, as the `block_in_place`/`block_on` combo is only usable for multi-threaded runtimes, this new codepath now requires the use of a multi-threaded runtime in `sync_wallets` (note this is the case even though we use a stored, *different* multi-threaded runtime for the actual broadcasting. **sigh**). --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e955ad2cb..c12296dbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -988,7 +988,7 @@ impl Node { ]; tokio::task::block_in_place(move || { - tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on( + tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap().block_on( async move { let now = Instant::now(); match wallet.sync().await {