From e03a1ac50bdb1f19b723107b07b61a4c9d48116f Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 14 Jun 2026 15:14:05 +0000 Subject: [PATCH] docs: correct stale doc-comments for LAN handshake and mesh-size poll_lan_discovery's comment said Noise XX, but LAN-discovered peers dial over UDP through initiate_connection, which uses Noise IK (IK at FMP). compute_mesh_size's header comment still described the obsolete sum-of-disjoint-subtrees estimate; the function OR-unions every connected peer's inbound filter plus self and estimates cardinality once (matching the body comment). Comment-only, no behavior change. --- src/node/lifecycle.rs | 4 ++-- src/node/mod.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/node/lifecycle.rs b/src/node/lifecycle.rs index d2ba455..be9a4d5 100644 --- a/src/node/lifecycle.rs +++ b/src/node/lifecycle.rs @@ -901,9 +901,9 @@ impl Node { } } - /// Drain mDNS-discovered peers and initiate Noise XX handshakes. + /// Drain mDNS-discovered peers and initiate Noise IK handshakes. /// The handshake itself is the authentication — a spoofed mDNS advert - /// with someone else's npub fails the XX exchange and is dropped. + /// with someone else's npub fails the IK exchange and is dropped. pub(super) async fn poll_lan_discovery(&mut self) { let Some(runtime) = self.lan_discovery.clone() else { return; diff --git a/src/node/mod.rs b/src/node/mod.rs index 1120b75..e9bb248 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -1307,9 +1307,12 @@ impl Node { /// Compute and cache the estimated mesh size from bloom filters. /// - /// Uses the spanning tree partition: parent's filter covers nodes reachable - /// upward, children's filters cover disjoint subtrees downward. The sum - /// of estimated entry counts plus one (self) approximates total network size. + /// Builds an OR-union of self plus every connected peer's inbound filter + /// and estimates its cardinality once. Unioning (rather than summing + /// per-peer counts) deduplicates the overlap between the split-horizon + /// filters, each of which approximates "the whole mesh minus my subtree". + /// See the body for why all routing peers contribute, not just the tree + /// neighborhood. pub(crate) fn compute_mesh_size(&mut self) { let my_addr = *self.tree_state.my_node_addr();