findNode

fun findNode(target: Sha1Hash, count: Int = 0, includeFailed: Boolean = false): List<NodeEntry>

Gather up to count nodes from our buckets closest (by XOR distance) to target. Port of std::vector<node_entry> routing_table::find_node(node_id const& target, find_nodes_flags_t options, int count).

It scans outward from target's home bucket toward higher-numbered buckets, then back toward bucket 0, sorting only the final over-full slice by compareRef to the target. With includeFailed = false (the default) only confirmed() nodes are returned.

Parameters

count

the desired number of nodes; 0 means bucketSize.

includeFailed

if true, also include non-confirmed (failed / un-pinged) live nodes (include_failed flag).