From 54889d8deb7c694a73cb1407610d2e1be39a91e0 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` implementation, which 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 34be513b9..ed75c7353 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1003,7 +1003,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 {