From 9ddddef2b3d42daf10bc390e256e77bdb4e99747 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Mon, 28 Jul 2025 16:10:56 +0100 Subject: [PATCH] fix(kyoto): make a runtime environment for DNS The `lookup_host` function requires a `tokio` runtime to execute, but since it is outside of the `Node`, this function panics when called. Add a runtime, which is essentially an OS thread in this context, to complete the call. --- bdk-ffi/src/kyoto.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bdk-ffi/src/kyoto.rs b/bdk-ffi/src/kyoto.rs index e836ddf5..0009122c 100644 --- a/bdk-ffi/src/kyoto.rs +++ b/bdk-ffi/src/kyoto.rs @@ -368,7 +368,11 @@ impl CbfClient { /// for compact block filter nodes from the seeder. For example `dns.myseeder.com` will be queried /// as `x849.dns.myseeder.com`. This has no guarantee to return any `IpAddr`. pub async fn lookup_host(&self, hostname: String) -> Vec> { - let nodes = lookup_host(hostname, self.dns_resolver).await; + let nodes = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap() + .block_on(lookup_host(hostname, self.dns_resolver)); nodes .into_iter() .map(|ip| Arc::new(IpAddress { inner: ip }))