@@ -45,7 +45,6 @@ use lightning::routing::scoring::{
4545 ProbabilisticScorer , ProbabilisticScoringDecayParameters , ProbabilisticScoringFeeParameters ,
4646} ;
4747use lightning:: sign:: EntropySource ;
48- use lightning:: onion_message:: messenger:: Destination ;
4948
5049use lightning:: util:: persist:: {
5150 read_channel_monitors, CHANNEL_MANAGER_PERSISTENCE_KEY ,
@@ -173,6 +172,8 @@ pub enum BuildError {
173172 LoggerSetupFailed ,
174173 /// The given network does not match the node's previously configured network.
175174 NetworkMismatch ,
175+ /// The dns_resolvers list provided for HRN resolution is empty
176+ DnsResolversEmpty ,
176177}
177178
178179impl fmt:: Display for BuildError {
@@ -200,6 +201,9 @@ impl fmt::Display for BuildError {
200201 Self :: NetworkMismatch => {
201202 write ! ( f, "Given network does not match the node's previously configured network." )
202203 } ,
204+ Self :: DnsResolversEmpty => {
205+ write ! ( f, "The dns_resolvers list provided for HRN resolution is empty." )
206+ } ,
203207 }
204208 }
205209}
@@ -459,8 +463,13 @@ impl NodeBuilder {
459463 }
460464
461465 /// Sets the default dns_resolvers to be used when sending payments to HRNs.
462- pub fn set_dns_resolvers ( & mut self , dns_resolvers : Vec < Destination > ) -> Result < & mut Self , BuildError > {
463- self . config . dns_resolvers = Some ( dns_resolvers) ;
466+ pub fn set_dns_resolvers (
467+ & mut self , dns_resolvers_node_ids : Vec < PublicKey > ,
468+ ) -> Result < & mut Self , BuildError > {
469+ if dns_resolvers_node_ids. is_empty ( ) {
470+ return Err ( BuildError :: DnsResolversEmpty ) ;
471+ }
472+ self . config . dns_resolvers_node_ids = Some ( dns_resolvers_node_ids) ;
464473 Ok ( self )
465474 }
466475
@@ -846,8 +855,8 @@ impl ArcedNodeBuilder {
846855 }
847856
848857 /// Sets the default dns_resolvers to be used when sending payments to HRNs.
849- pub fn set_dns_resolvers ( & self , dns_resolvers : Vec < Destination > ) -> Result < ( ) , BuildError > {
850- self . inner . write ( ) . unwrap ( ) . set_dns_resolvers ( dns_resolvers ) . map ( |_| ( ) ) ;
858+ pub fn set_dns_resolvers ( & self , dns_resolvers_node_ids : Vec < PublicKey > ) -> Result < ( ) , BuildError > {
859+ self . inner . write ( ) . unwrap ( ) . set_dns_resolvers ( dns_resolvers_node_ids ) . map ( |_| ( ) )
851860 }
852861
853862 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
0 commit comments