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.
This commit is contained in:
Johnathan Corgan
2026-04-05 12:23:24 +00:00
parent 15628e5b41
commit a859da7748

View File

@@ -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