Skip to content

Commit 36f33a8

Browse files
committed
Add configurration 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 80a1745 commit 36f33a8

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
@@ -116,7 +116,8 @@ pub(crate) const EXTERNAL_PATHFINDING_SCORES_SYNC_TIMEOUT_SECS: u64 = 5;
116116
/// | `probing_liquidity_limit_multiplier` | 3 |
117117
/// | `log_level` | Debug |
118118
/// | `anchor_channels_config` | Some(..) |
119-
/// | `route_parameters` | None |
119+
/// | `route_parameters` | None |
120+
/// | `hrn_config` | Some(..) |
120121
///
121122
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
122123
/// respective default values.
@@ -181,6 +182,10 @@ pub struct Config {
181182
/// **Note:** If unset, default parameters will be used, and you will be able to override the
182183
/// parameters on a per-payment basis in the corresponding method calls.
183184
pub route_parameters: Option<RouteParametersConfig>,
185+
/// Configuration options for Human-Readable Names ([BIP 353]).
186+
///
187+
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
188+
pub hrn_config: Option<HumanReadableNamesConfig>,
184189
}
185190

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

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)