From a859da7748d7355da24ed4c67dba47751b4da4d3 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 5 Apr 2026 12:23:24 +0000 Subject: [PATCH] Fix bloom filter routing blocking greedy tree fallback When bloom filter candidates existed but none were strictly closer to the destination in tree-coordinate distance, find_next_hop returned None without trying greedy tree routing. This caused NoRoute failures in topologies where the tree parent was closer but not a bloom candidate. Fall through to tree routing when no bloom candidate makes progress. --- src/node/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/node/mod.rs b/src/node/mod.rs index 5c29e9e..cf3c490 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -1391,10 +1391,13 @@ impl Node { .unwrap_or(0); let dest_coords = self.coord_cache.get_and_touch(dest_node_addr, now_ms)?.clone(); - // 3. Bloom filter candidates — requires dest_coords for loop-free selection + // 3. Bloom filter candidates — requires dest_coords for loop-free selection. + // If no candidate is strictly closer, fall through to tree routing. let candidates: Vec<&ActivePeer> = self.destination_in_filters(dest_node_addr); - if !candidates.is_empty() { - return self.select_best_candidate(&candidates, &dest_coords); + if !candidates.is_empty() + && let Some(peer) = self.select_best_candidate(&candidates, &dest_coords) + { + return Some(peer); } // 4. Greedy tree routing fallback