Filter Disconnected Peers from Discv5 DHT (#2219)

## Issue Addressed
#2107

## Proposed Change
The peer manager will mark peers as disconnected in the discv5 DHT when they disconnect or dial fails

## Additional Info
Rationale for this particular change is explained in my comment on #2107
This commit is contained in:
ethDreamer
2021-04-28 04:07:37 +00:00
parent 0754ba3be7
commit 0aa8509525
2 changed files with 10 additions and 0 deletions

View File

@@ -514,6 +514,13 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
}
}
// mark node as disconnected in DHT, freeing up space for other nodes
pub fn disconnect_peer(&mut self, peer_id: &PeerId) {
if let Ok(node_id) = peer_id_to_node_id(peer_id) {
self.discv5.disconnect_node(&node_id);
}
}
/* Internal Functions */
/// Adds a subnet query if one doesn't exist. If a subnet query already exists, this