Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion portalnet/src/overlay_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2360,11 +2360,15 @@ where
}
}

/// Returns a vector of all the ENRs of nodes currently contained in the routing table.
/// Returns a vector of all the ENRs of nodes currently contained in the routing table which are connected.
fn table_entries_enr(&self) -> Vec<Enr> {
self.kbuckets
.write()
.iter()
.filter(|entry| {
// Filter out disconnected nodes.
entry.status.is_connected()
})
.map(|entry| entry.node.value.enr())
.collect()
}
Expand All @@ -2387,6 +2391,10 @@ where
for node in kbuckets
.nodes_by_distances(log2_distances, FIND_NODES_MAX_NODES)
.into_iter()
.filter(|entry| {
// Filter out disconnected nodes.
entry.status.is_connected()
})
.map(|entry| entry.node.value.clone())
{
nodes_to_send.push(SszEnr::new(node.enr()));
Expand Down