Skip to content

Commit 9ddddef

Browse files
committed
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.
1 parent b955a48 commit 9ddddef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bdk-ffi/src/kyoto.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,11 @@ impl CbfClient {
368368
/// for compact block filter nodes from the seeder. For example `dns.myseeder.com` will be queried
369369
/// as `x849.dns.myseeder.com`. This has no guarantee to return any `IpAddr`.
370370
pub async fn lookup_host(&self, hostname: String) -> Vec<Arc<IpAddress>> {
371-
let nodes = lookup_host(hostname, self.dns_resolver).await;
371+
let nodes = tokio::runtime::Builder::new_current_thread()
372+
.enable_all()
373+
.build()
374+
.unwrap()
375+
.block_on(lookup_host(hostname, self.dns_resolver));
372376
nodes
373377
.into_iter()
374378
.map(|ip| Arc::new(IpAddress { inner: ip }))

0 commit comments

Comments
 (0)