@@ -47,7 +47,6 @@ use lightning::routing::scoring::{
4747 ProbabilisticScorer , ProbabilisticScoringDecayParameters , ProbabilisticScoringFeeParameters ,
4848} ;
4949use lightning:: sign:: EntropySource ;
50- use lightning:: onion_message:: messenger:: Destination ;
5150
5251use lightning:: util:: persist:: {
5352 read_channel_monitors, CHANNEL_MANAGER_PERSISTENCE_KEY ,
@@ -175,6 +174,8 @@ pub enum BuildError {
175174 LoggerSetupFailed ,
176175 /// The given network does not match the node's previously configured network.
177176 NetworkMismatch ,
177+ /// The dns_resolvers list provided for HRN resolution is empty
178+ DnsResolversEmpty ,
178179}
179180
180181impl fmt:: Display for BuildError {
@@ -202,6 +203,9 @@ impl fmt::Display for BuildError {
202203 Self :: NetworkMismatch => {
203204 write ! ( f, "Given network does not match the node's previously configured network." )
204205 } ,
206+ Self :: DnsResolversEmpty => {
207+ write ! ( f, "The dns_resolvers list provided for HRN resolution is empty." )
208+ } ,
205209 }
206210 }
207211}
@@ -461,8 +465,13 @@ impl NodeBuilder {
461465 }
462466
463467 /// Sets the default dns_resolvers to be used when sending payments to HRNs.
464- pub fn set_dns_resolvers ( & mut self , dns_resolvers : Vec < Destination > ) -> Result < & mut Self , BuildError > {
465- self . config . dns_resolvers = Some ( dns_resolvers) ;
468+ pub fn set_dns_resolvers (
469+ & mut self , dns_resolvers_node_ids : Vec < PublicKey > ,
470+ ) -> Result < & mut Self , BuildError > {
471+ if dns_resolvers_node_ids. is_empty ( ) {
472+ return Err ( BuildError :: DnsResolversEmpty ) ;
473+ }
474+ self . config . dns_resolvers_node_ids = Some ( dns_resolvers_node_ids) ;
466475 Ok ( self )
467476 }
468477
@@ -848,8 +857,8 @@ impl ArcedNodeBuilder {
848857 }
849858
850859 /// Sets the default dns_resolvers to be used when sending payments to HRNs.
851- pub fn set_dns_resolvers ( & self , dns_resolvers : Vec < Destination > ) -> Result < ( ) , BuildError > {
852- self . inner . write ( ) . unwrap ( ) . set_dns_resolvers ( dns_resolvers ) . map ( |_| ( ) ) ;
860+ pub fn set_dns_resolvers ( & self , dns_resolvers_node_ids : Vec < PublicKey > ) -> Result < ( ) , BuildError > {
861+ self . inner . write ( ) . unwrap ( ) . set_dns_resolvers ( dns_resolvers_node_ids ) . map ( |_| ( ) )
853862 }
854863
855864 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
0 commit comments