Skip to content

Commit 457b634

Browse files
committed
Allow a DNSResolverMessageHandler to set dns_resolver feature
A `DNSResolverMessageHandler` which handles resolution requests should want the `NodeFeatures` included in the node's `node_announcement` to include `dns_resolver` to indicate to the world that it provides that service. Here we enable this by requesting extra feature flags from the `DNSResolverMessageHandler` in the features `OnionMessenger`, in turn, provides to `PeerManager` (which builds the `node_announcement`).
1 parent 1abbe2a commit 457b634

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lightning/src/onion_message/dns_resolution.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ use dnssec_prover::validation::verify_rr_stream;
3434

3535
use dnssec_prover::rr::Name;
3636

37+
use lightning_types::features::NodeFeatures;
38+
3739
use crate::blinded_path::message::DNSResolverContext;
3840
use crate::io;
3941
#[cfg(feature = "dnssec")]
@@ -67,6 +69,13 @@ pub trait DNSResolverMessageHandler {
6769
/// With this, we should be able to validate the DNS record we requested.
6870
fn handle_dnssec_proof(&self, message: DNSSECProof, context: DNSResolverContext);
6971

72+
/// Gets the node feature flags which this handler itself supports. Useful for setting the
73+
/// `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response
74+
/// to [`DNSSECQuery`] messages.
75+
fn provided_node_features(&self) -> NodeFeatures {
76+
NodeFeatures::empty()
77+
}
78+
7079
/// Release any [`DNSResolverMessage`]s that need to be sent.
7180
fn release_pending_messages(&self) -> Vec<(DNSResolverMessage, MessageSendInstructions)> {
7281
vec![]

lightning/src/onion_message/messenger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ where
17781778
fn provided_node_features(&self) -> NodeFeatures {
17791779
let mut features = NodeFeatures::empty();
17801780
features.set_onion_messages_optional();
1781-
features
1781+
features | self.dns_resolver_handler.provided_node_features()
17821782
}
17831783

17841784
fn provided_init_features(&self, _their_node_id: PublicKey) -> InitFeatures {

0 commit comments

Comments
 (0)