Skip to content
Snippets Groups Projects
Commit 7530a0c4 authored by ordian's avatar ordian Committed by GitHub
Browse files

validator_discovery: some logs to help identify authority discovery issues (#2533)

parent 48409e55
Branches
No related merge requests found
......@@ -264,6 +264,8 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
if let Some(addresses) = result {
// We might have several `PeerId`s per `AuthorityId`
multiaddr_to_add.extend(addresses.into_iter().take(MAX_ADDR_PER_PEER));
} else {
tracing::debug!(target: LOG_TARGET, "Authority Discovery couldn't resolve {:?}", authority);
}
}
......@@ -282,6 +284,9 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
}
// clean up revoked requests states
//
// note that the `.rev()` here is important to guarantee `swap_remove`
// doesn't invalidate unprocessed `revoked_indices`
for to_revoke in revoked_indices.into_iter().rev() {
drop(state.non_revoked_discovery_requests.swap_remove(to_revoke));
}
......@@ -289,9 +294,15 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
// multiaddresses to remove
let mut multiaddr_to_remove = HashSet::new();
for id in revoked_validators.into_iter() {
let result = authority_discovery_service.get_addresses_by_authority_id(id).await;
let result = authority_discovery_service.get_addresses_by_authority_id(id.clone()).await;
if let Some(addresses) = result {
multiaddr_to_remove.extend(addresses.into_iter());
} else {
tracing::debug!(
target: LOG_TARGET,
"Authority Discovery couldn't resolve {:?} on cleanup, a leak is possible",
id,
);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment