Skip to content

Commit 9ba57d7

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 1f51948 commit 9ba57d7

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

bindings/ldk_node.udl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dictionary Config {
1313
u64 probing_liquidity_limit_multiplier;
1414
AnchorChannelsConfig? anchor_channels_config;
1515
RouteParametersConfig? route_parameters;
16+
HumanReadableNamesConfig? hrn_config;
1617
};
1718

1819
dictionary AnchorChannelsConfig {
@@ -501,6 +502,12 @@ dictionary RouteParametersConfig {
501502
u8 max_channel_saturation_power_of_half;
502503
};
503504

505+
dictionary HumanReadableNamesConfig {
506+
sequence<PublicKey> default_dns_resolvers;
507+
boolean is_hrn_resolver;
508+
string dns_server_address;
509+
};
510+
504511
dictionary CustomTlvRecord {
505512
u64 type_num;
506513
sequence<u8> value;

src/config.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ pub(crate) const HRN_RESOLUTION_TIMEOUT_SECS: u64 = 5;
119119
/// | `probing_liquidity_limit_multiplier` | 3 |
120120
/// | `log_level` | Debug |
121121
/// | `anchor_channels_config` | Some(..) |
122-
/// | `route_parameters` | None |
122+
/// | `route_parameters` | None |
123+
/// | `hrn_config` | Some(..) |
123124
///
124125
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
125126
/// respective default values.
@@ -184,6 +185,10 @@ pub struct Config {
184185
/// **Note:** If unset, default parameters will be used, and you will be able to override the
185186
/// parameters on a per-payment basis in the corresponding method calls.
186187
pub route_parameters: Option<RouteParametersConfig>,
188+
/// Configuration options for Human-Readable Names ([BIP 353]).
189+
///
190+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
191+
pub hrn_config: Option<HumanReadableNamesConfig>,
187192
}
188193

189194
impl Default for Config {
@@ -198,6 +203,34 @@ impl Default for Config {
198203
anchor_channels_config: Some(AnchorChannelsConfig::default()),
199204
route_parameters: None,
200205
node_alias: None,
206+
hrn_config: Some(HumanReadableNamesConfig::default()),
207+
}
208+
}
209+
}
210+
211+
/// Configuration options for Human-Readable Names ([BIP 353]).
212+
///
213+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
214+
#[derive(Debug, Clone)]
215+
pub struct HumanReadableNamesConfig {
216+
/// The Default DNS resolvers to be used for resolving Human-Readable Names.
217+
///
218+
/// If not empty, the values set will be used as DNS resolvers when sending to HRNs.
219+
///
220+
/// **Note:** If empty, DNS resolvers would be selected from the network graph.
221+
pub default_dns_resolvers: Vec<PublicKey>,
222+
/// This allows us to use our node as a DNS resolver for 3rd party HRN resolutions.
223+
pub is_hrn_resolver: bool,
224+
/// The DNS Server which will be used for resolving HRNs.
225+
pub dns_server_address: String,
226+
}
227+
228+
impl Default for HumanReadableNamesConfig {
229+
fn default() -> Self {
230+
HumanReadableNamesConfig {
231+
default_dns_resolvers: Vec::new(),
232+
is_hrn_resolver: false,
233+
dns_server_address: String::new(),
201234
}
202235
}
203236
}

src/ffi/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub use vss_client::headers::{VssHeaderProvider, VssHeaderProviderError};
4646
use crate::builder::sanitize_alias;
4747
pub use crate::config::{
4848
default_config, AnchorChannelsConfig, BackgroundSyncConfig, ElectrumSyncConfig,
49-
EsploraSyncConfig, MaxDustHTLCExposure,
49+
EsploraSyncConfig, HumanReadableNamesConfig, MaxDustHTLCExposure,
5050
};
5151
pub use crate::entropy::{generate_entropy_mnemonic, EntropyError, NodeEntropy, WordCount};
5252
use crate::error::Error;

0 commit comments

Comments
 (0)