mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 02:12:33 +00:00
Move peer db writes to eth2 libp2p (#2724)
## Issue Addressed Part of a bigger effort to make the network globals read only. This moves all writes to the `PeerDB` to the `eth2_libp2p` crate. Limiting writes to the peer manager is a slightly more complicated issue for a next PR, to keep things reviewable. ## Proposed Changes - Make the peers field in the globals a private field. - Allow mutable access to the peers field to `eth2_libp2p` for now. - Add a new network message to update the sync state. Co-authored-by: Age Manning <Age@AgeManning.com>
This commit is contained in:
@@ -154,7 +154,7 @@ impl<T: BeaconChainTypes> Router<T> {
|
||||
|
||||
/// A new RPC request has been received from the network.
|
||||
fn handle_rpc_request(&mut self, peer_id: PeerId, id: PeerRequestId, request: Request) {
|
||||
if !self.network_globals.peers.read().is_connected(&peer_id) {
|
||||
if !self.network_globals.peers().is_connected(&peer_id) {
|
||||
debug!(self.log, "Dropping request of disconnected peer"; "peer_id" => %peer_id, "request" => ?request);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user