Discovery and gossip bug fixes
This commit is contained in:
parent
25f37ad967
commit
75959cc9a2
@ -22,5 +22,5 @@ tokio-timer = "0.2.10"
|
||||
futures = "0.1.25"
|
||||
exit-future = "0.1.3"
|
||||
state_processing = { path = "../eth2/state_processing" }
|
||||
slog = { version = "^2.2.3" , features = ["max_level_trace", "release_max_level_debug"] }
|
||||
slog = "^2.2.3"
|
||||
env_logger = "0.6.1"
|
||||
|
@ -19,7 +19,7 @@ slot_clock = { path = "../../eth2/utils/slot_clock" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
error-chain = "0.12.0"
|
||||
slog = { version = "^2.2.3" , features = ["max_level_trace", "release_max_level_debug"] }
|
||||
slog = "^2.2.3"
|
||||
slog-term = "^2.4.0"
|
||||
slog-async = "^2.3.0"
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
|
@ -15,7 +15,7 @@ serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
ssz_derive = { path = "../../eth2/utils/ssz_derive" }
|
||||
slog = "2.4.1"
|
||||
slog = "^2.2.3"
|
||||
version = { path = "../version" }
|
||||
tokio = "0.1.16"
|
||||
futures = "0.1.25"
|
||||
|
@ -83,18 +83,9 @@ where
|
||||
NetworkBehaviour::new_handler(&mut self.discovery)
|
||||
}
|
||||
|
||||
// TODO: we store all peers in known_peers, when upgrading to discv5 we will avoid duplication
|
||||
// of peer storage.
|
||||
fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec<Multiaddr> {
|
||||
if let Some(addresses) = self.known_peers.get(peer_id) {
|
||||
addresses.clone()
|
||||
} else {
|
||||
debug!(
|
||||
self.log,
|
||||
"Tried to dial: {:?} but no address stored", peer_id
|
||||
);
|
||||
Vec::new()
|
||||
}
|
||||
// Let discovery track possible known peers.
|
||||
self.discovery.addresses_of_peer(peer_id)
|
||||
}
|
||||
|
||||
fn inject_connected(&mut self, peer_id: PeerId, endpoint: ConnectedPoint) {
|
||||
@ -151,11 +142,6 @@ where
|
||||
peer_id, addresses, ..
|
||||
} => {
|
||||
debug!(self.log, "Kademlia peer discovered"; "Peer"=> format!("{:?}", peer_id), "Addresses" => format!("{:?}", addresses));
|
||||
(*self
|
||||
.known_peers
|
||||
.entry(peer_id.clone())
|
||||
.or_insert_with(|| vec![]))
|
||||
.extend(addresses.clone());
|
||||
}
|
||||
KademliaOut::FindNodeResult { closer_peers, .. } => {
|
||||
debug!(
|
||||
@ -163,6 +149,8 @@ where
|
||||
"Kademlia query found {} peers",
|
||||
closer_peers.len()
|
||||
);
|
||||
debug!(self.log, "Kademlia peers discovered"; "Peer"=> format!("{:?}", closer_peers));
|
||||
|
||||
if closer_peers.is_empty() {
|
||||
debug!(self.log, "Kademlia random query yielded empty results");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user