f note that only one resolution will fail at a time
What changed, and why it matters
This commit only adds two explanatory comments to the code. It does not change any program behavior, fix any bug, or alter any logic. The comments clarify that although the code is written to handle multiple failed DNS resolutions at once, in practice only one can fail at a time because each resolution uses a unique random identifier.
No security action needed. This is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds identical comments in two places within lightning/src/onion_message/dns_resolution.rs. Both comments explain that the Vec-based API for failed resolutions is future-proofing for potentially joining multiple queries for the same name, but currently at most one resolution can exhaust its pending_query_contexts per event because each context carries a unique random nonce. No code paths, data structures, error handling, or control flow are modified.
Changed components
lightning/src/onion_message/dns_resolution.rsInspect captured patch +6 / −0
diff --git a/lightning/src/onion_message/dns_resolution.rs b/lightning/src/onion_message/dns_resolution.rs
index d0746fe..8850147 100644
--- a/lightning/src/onion_message/dns_resolution.rs
+++ b/lightning/src/onion_message/dns_resolution.rs
@@ -597,6 +597,9 @@ impl OMNameResolver {
Err(()) => Err(requests),
}
} else {
+ // Note that because each context has a unique random nonce, at most one resolution
+ // can run out of pending queries here. Still, the API returns a Vec as we may join
+ // multiple queries for the same name in the future.
let mut failed_resolutions = Vec::new();
entry.get_mut().retain_mut(|query| {
query.pending_query_contexts.retain(|c| *c != context);
@@ -698,6 +701,9 @@ impl OMNameResolver {
// any. If no contexts match (including because a previous error already removed
// this context), the error does not pertain to this resolution and it is left
// untouched.
+ // Note that because each context has a unique random nonce, at most one resolution
+ // can run out of pending queries here. Still, the API returns a Vec as we may join
+ // multiple queries for the same name in the future.
resolution.pending_query_contexts.retain(|c| *c != context);
if resolution.pending_query_contexts.is_empty() {
failed_resolutions.push((resolution.name, resolution.payment_id));
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.