Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
validator_discovery: some logs to help identify authority discovery i…
Browse files Browse the repository at this point in the history
…ssues (#2533)
  • Loading branch information
ordian authored Feb 26, 2021
1 parent 950447e commit ad3f3fb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion node/network/bridge/src/validator_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -282,16 +284,25 @@ 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));
}

// 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,
);
}
}

Expand Down

0 comments on commit ad3f3fb

Please sign in to comment.