Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(discv5): add tracing #7663

Merged
merged 1 commit into from Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/net/discv5/src/lib.rs
Expand Up @@ -310,13 +310,16 @@ impl Discv5 {
discv5.with_kbuckets(|kbuckets| kbuckets.read().iter_ref().count()),
);

// make sure node is connected to each subtree in the network by target
// selection (ref kademlia)
let target = get_lookup_target(log2_distance, local_node_id);

trace!(target: "net::discv5",
target=format!("{:#?}", target),
lookup_interval=format!("{:#?}", lookup_interval),
"starting periodic lookup query"
);
// make sure node is connected to each subtree in the network by target
// selection (ref kademlia)
let target = get_lookup_target(log2_distance, local_node_id);

if log2_distance < MAX_LOG2_DISTANCE {
// try to populate bucket one step further away
log2_distance += 1
Expand All @@ -331,6 +334,7 @@ impl Discv5 {
"periodic lookup query failed"
),
Ok(peers) => trace!(target: "net::discv5",
target=format!("{:#?}", target),
lookup_interval=format!("{:#?}", lookup_interval),
peers_count=peers.len(),
peers=format!("[{:#}]", peers.iter()
Expand Down