mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
## Proposed Changes
This reverts commit 53562010ec from PR #2724
Hopefully this will restore the reliability of the sync simulator.
This commit is contained in:
@@ -10,9 +10,7 @@ use fnv::FnvHashMap;
|
||||
use lighthouse_network::rpc::{
|
||||
BlocksByRangeRequest, BlocksByRootRequest, GoodbyeReason, RequestId,
|
||||
};
|
||||
use lighthouse_network::{
|
||||
Client, NetworkGlobals, PeerAction, PeerId, ReportSource, Request, SyncStatus,
|
||||
};
|
||||
use lighthouse_network::{Client, NetworkGlobals, PeerAction, PeerId, ReportSource, Request};
|
||||
use slog::{debug, trace, warn};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
@@ -54,7 +52,12 @@ impl<T: EthSpec> SyncNetworkContext<T> {
|
||||
|
||||
/// Returns the Client type of the peer if known
|
||||
pub fn client_type(&self, peer_id: &PeerId) -> Client {
|
||||
self.network_globals.client(peer_id)
|
||||
self.network_globals
|
||||
.peers
|
||||
.read()
|
||||
.peer_info(peer_id)
|
||||
.map(|info| info.client().clone())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn status_peers<C: ToStatusMessage>(
|
||||
@@ -205,17 +208,10 @@ impl<T: EthSpec> SyncNetworkContext<T> {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn update_peer_sync_status(&self, peer_id: PeerId, new_status: SyncStatus) {
|
||||
let _ = self.send_network_msg(NetworkMessage::UpdatePeerSyncStatus {
|
||||
peer_id,
|
||||
sync_status: new_status,
|
||||
});
|
||||
}
|
||||
|
||||
/// Sends an arbitrary network message.
|
||||
fn send_network_msg(&self, msg: NetworkMessage<T>) -> Result<(), &'static str> {
|
||||
self.network_send.send(msg).map_err(|msg| {
|
||||
warn!(self.log, "Could not send message to the network service"; "msg" => ?msg.0);
|
||||
fn send_network_msg(&mut self, msg: NetworkMessage<T>) -> Result<(), &'static str> {
|
||||
self.network_send.send(msg).map_err(|_| {
|
||||
debug!(self.log, "Could not send message to the network service");
|
||||
"Network channel send Failed"
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user