Skip to content

Commit ccd3459

Browse files
committed
Add configuration options for HRN settings
Introduce new configuration parameters to manage Human-Readable Name (HRN) resolution and DNSSEC validation behavior. These settings allow users to define custom resolution preferences for BOLT12 offer lookups. Moving these parameters into the central configuration struct ensures that node behavior is customizable at runtime and consistent across different network environments. This abstraction is necessary to support diverse DNSSEC requirements without hard-coding resolution logic.
1 parent 399cb65 commit ccd3459

3 files changed

Lines changed: 62 additions & 2 deletions

File tree

bindings/ldk_node.udl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ dictionary RouteParametersConfig {
252252
u8 max_channel_saturation_power_of_half;
253253
};
254254

255+
typedef interface HRNResolverConfig;
256+
257+
typedef dictionary HumanReadableNamesConfig;
258+
255259
[Remote]
256260
dictionary LSPS1OrderStatus {
257261
LSPS1OrderId order_id;

src/config.rs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ pub(crate) const HRN_RESOLUTION_TIMEOUT_SECS: u64 = 5;
128128
/// | `probing_liquidity_limit_multiplier` | 3 |
129129
/// | `log_level` | Debug |
130130
/// | `anchor_channels_config` | Some(..) |
131-
/// | `route_parameters` | None |
131+
/// | `route_parameters` | None |
132+
/// | `hrn_config` | Some(..) |
132133
///
133134
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
134135
/// respective default values.
@@ -193,6 +194,10 @@ pub struct Config {
193194
/// **Note:** If unset, default parameters will be used, and you will be able to override the
194195
/// parameters on a per-payment basis in the corresponding method calls.
195196
pub route_parameters: Option<RouteParametersConfig>,
197+
/// Configuration options for Human-Readable Names ([BIP 353]).
198+
///
199+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
200+
pub hrn_config: HumanReadableNamesConfig,
196201
}
197202

198203
impl Default for Config {
@@ -207,6 +212,54 @@ impl Default for Config {
207212
anchor_channels_config: Some(AnchorChannelsConfig::default()),
208213
route_parameters: None,
209214
node_alias: None,
215+
hrn_config: HumanReadableNamesConfig::default(),
216+
}
217+
}
218+
}
219+
220+
/// Configuration options for how our node resolves Human-Readable Names (BIP 353) when acting as a client.
221+
///
222+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
223+
#[derive(Debug, Clone)]
224+
pub enum HRNResolverConfig {
225+
/// Use [bLIP-32] to ask other nodes to resolve names for us.
226+
///
227+
/// [bLIP-32]: https://github.com/lightning/blips/blob/master/blip-0032.md
228+
Blip32,
229+
/// Resolve names locally using a specific DNS server.
230+
Dns {
231+
/// The IP and port of the DNS server.
232+
/// **Default:** `8.8.8.8:53` (Google Public DNS)
233+
dns_server_address: String,
234+
/// If set to true, this allows others to use our node for HRN resolutions.
235+
///
236+
/// **Note:** Enabling `enable_hrn_resolution_service` is only one part of the
237+
/// configuration. For resolution to function correctly, the local node must
238+
/// also be configured as an **announceable node** within the network.
239+
enable_hrn_resolution_service: bool,
240+
},
241+
}
242+
243+
/// Configuration options for Human-Readable Names ([BIP 353]).
244+
///
245+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
246+
#[derive(Debug, Clone)]
247+
pub struct HumanReadableNamesConfig {
248+
/// This sets how our node resolves names when we want to send a payment.
249+
///
250+
/// By default, this uses the `Dns` variant with the following settings:
251+
/// * **DNS Server**: `8.8.8.8:53` (Google Public DNS)
252+
/// * **Resolution Service**: Enabled (`true`)
253+
pub resolution_config: HRNResolverConfig,
254+
}
255+
256+
impl Default for HumanReadableNamesConfig {
257+
fn default() -> Self {
258+
HumanReadableNamesConfig {
259+
resolution_config: HRNResolverConfig::Dns {
260+
dns_server_address: "8.8.8.8:53".to_string(),
261+
enable_hrn_resolution_service: true,
262+
},
210263
}
211264
}
212265
}

src/ffi/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ impl VssClientHeaderProvider for VssHeaderProviderAdapter {
138138
}
139139

140140
use crate::builder::sanitize_alias;
141-
pub use crate::config::{default_config, ElectrumSyncConfig, EsploraSyncConfig};
141+
pub use crate::config::{
142+
default_config, ElectrumSyncConfig, EsploraSyncConfig, HRNResolverConfig,
143+
HumanReadableNamesConfig,
144+
};
142145
pub use crate::entropy::{generate_entropy_mnemonic, NodeEntropy, WordCount};
143146
use crate::error::Error;
144147
pub use crate::liquidity::LSPS1OrderStatus;

0 commit comments

Comments
 (0)