Skip to content

Commit 3ccf481

Browse files
committed
fixup! Add configuration options for HRN settings
Add config options for bLIP-32 client (sending to HRNs) and make node a bLIP-32 service by default - by default, use LocalDNS resolution for sending to HRNs.
1 parent 6482054 commit 3ccf481

3 files changed

Lines changed: 30 additions & 17 deletions

File tree

bindings/ldk_node.udl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,15 @@ dictionary RouteParametersConfig {
517517
u8 max_channel_saturation_power_of_half;
518518
};
519519

520+
[Enum]
521+
interface HRNResolverConfig {
522+
Blip32Onion();
523+
LocalDns(string dns_server_address);
524+
};
525+
520526
dictionary HumanReadableNamesConfig {
521-
sequence<PublicKey> default_dns_resolvers;
522-
boolean is_hrn_resolver;
523-
string dns_server_address;
527+
HRNResolverConfig client_resolution_config;
528+
boolean disable_hrn_resolution_service;
524529
};
525530

526531
dictionary CustomTlvRecord {

src/config.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,29 +216,36 @@ impl Default for Config {
216216
}
217217
}
218218

219+
/// Configuration options for how our node resolves Human-Readable Names (HRNs) when acting as a client.
220+
#[derive(Debug, Clone)]
221+
pub enum HRNResolverConfig {
222+
/// Use bLIP-32 to ask other nodes to resolve names for us.
223+
Blip32Onion,
224+
/// Resolve names locally using a specific DNS server.
225+
LocalDns {
226+
/// The IP and port of the DNS server (e.g., "8.8.8.8:53").
227+
dns_server_address: String,
228+
},
229+
}
230+
219231
/// Configuration options for Human-Readable Names ([BIP 353]).
220232
///
221233
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
222234
#[derive(Debug, Clone)]
223235
pub struct HumanReadableNamesConfig {
224-
/// The Default DNS resolvers to be used for resolving Human-Readable Names.
225-
///
226-
/// If not empty, the values set will be used as DNS resolvers when sending to HRNs.
227-
///
228-
/// **Note:** If empty, DNS resolvers would be selected from the network graph.
229-
pub default_dns_resolvers: Vec<PublicKey>,
230-
/// This allows us to use our node as a DNS resolver for 3rd party HRN resolutions.
231-
pub is_hrn_resolver: bool,
232-
/// The DNS Server which will be used for resolving HRNs.
233-
pub dns_server_address: String,
236+
/// This sets how our node resolves names when we want to send a payment.
237+
pub client_resolution_config: HRNResolverConfig,
238+
/// if set, this allows others to use our node for HRN resolutions.
239+
pub disable_hrn_resolution_service: bool,
234240
}
235241

236242
impl Default for HumanReadableNamesConfig {
237243
fn default() -> Self {
238244
HumanReadableNamesConfig {
239-
default_dns_resolvers: Vec::new(),
240-
is_hrn_resolver: false,
241-
dns_server_address: String::new(),
245+
client_resolution_config: HRNResolverConfig::LocalDns {
246+
dns_server_address: "8.8.8.8:53".to_string(),
247+
},
248+
disable_hrn_resolution_service: false,
242249
}
243250
}
244251
}

src/ffi/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ 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, HumanReadableNamesConfig, MaxDustHTLCExposure, SyncTimeoutsConfig,
49+
EsploraSyncConfig, HRNResolverConfig, HumanReadableNamesConfig, MaxDustHTLCExposure,
50+
SyncTimeoutsConfig,
5051
};
5152
pub use crate::entropy::{generate_entropy_mnemonic, EntropyError, NodeEntropy, WordCount};
5253
use crate::error::Error;

0 commit comments

Comments
 (0)