Skip to content

Commit 8b693cc

Browse files
committed
fixup! Pass HRNResolver or DomainResolver into OnionMessenger
1 parent 254e03c commit 8b693cc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/builder.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,8 @@ fn build_with_store_internal(
15311531
let om_resolver = match &config.hrn_config {
15321532
None => Arc::new(IgnoringMessageHandler {}),
15331533
Some(hrn_config) => {
1534+
let runtime_handle = runtime.handle();
1535+
15341536
let client_resolver: Arc<dyn DNSResolverMessageHandler + Send + Sync> =
15351537
match &hrn_config.client_resolution_config {
15361538
HRNResolverConfig::Blip32Onion => {
@@ -1550,15 +1552,17 @@ fn build_with_store_internal(
15501552
}
15511553
}));
15521554

1553-
hrn_res
1555+
hrn_res as Arc<dyn DNSResolverMessageHandler + Send + Sync>
15541556
},
15551557
HRNResolverConfig::LocalDns { dns_server_address } => {
15561558
let addr = dns_server_address
15571559
.parse()
15581560
.map_err(|_| BuildError::DNSResolverSetupFailed)?;
15591561
let hrn_res = Arc::new(DNSHrnResolver(addr));
15601562
hrn_resolver_out = Some(Arc::new(HRNResolver::Local(hrn_res)));
1561-
Arc::new(OMDomainResolver::ignoring_incoming_proofs(addr))
1563+
let resolver = Arc::new(OMDomainResolver::ignoring_incoming_proofs(addr));
1564+
resolver.set_runtime(runtime_handle.clone());
1565+
resolver as Arc<dyn DNSResolverMessageHandler + Send + Sync>
15621566
},
15631567
};
15641568

@@ -1578,7 +1582,7 @@ fn build_with_store_internal(
15781582
Arc::new(OMDomainResolver::with_runtime(
15791583
service_dns_addr,
15801584
Some(client_resolver),
1581-
Some(runtime.handle().clone()),
1585+
Some(runtime_handle.clone()),
15821586
))
15831587
} else {
15841588
log_error!(logger, "To act as an HRN resolution service, the DNS resolver must be configured to use a DNS server.");

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ impl Node {
16691669
/// # use ldk_node::entropy::{generate_entropy_mnemonic, NodeEntropy};
16701670
/// # use rand::distr::Alphanumeric;
16711671
/// # use rand::{rng, Rng};
1672+
/// # tokio::runtime::Runtime::new().unwrap().block_on(async {
16721673
/// # let mut config = Config::default();
16731674
/// # config.network = Network::Regtest;
16741675
/// # let mut temp_path = std::env::temp_dir();
@@ -1680,6 +1681,7 @@ impl Node {
16801681
/// # let node_entropy = NodeEntropy::from_bip39_mnemonic(mnemonic, None);
16811682
/// # let node = builder.build(node_entropy.into()).unwrap();
16821683
/// node.list_payments_with_filter(|p| p.direction == PaymentDirection::Outbound);
1684+
/// # });
16831685
/// ```
16841686
pub fn list_payments_with_filter<F: FnMut(&&PaymentDetails) -> bool>(
16851687
&self, f: F,

0 commit comments

Comments
 (0)