mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 12:22:51 +00:00
Node endpoints (#1778)
## Issue Addressed `node` endpoints in #1434 ## Proposed Changes Implement these: ``` /eth/v1/node/health /eth/v1/node/peers/{peer_id} /eth/v1/node/peers ``` - Add an `Option<Enr>` to `PeerInfo` - Finish implementation of `/eth/v1/node/identity` ## Additional Info - should update the `peers` endpoints when #1764 is resolved Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@ mod peer_sync_status;
|
||||
mod peerdb;
|
||||
pub(crate) mod score;
|
||||
|
||||
pub use peer_info::{PeerConnectionStatus::*, PeerInfo};
|
||||
pub use peer_info::{ConnectionDirection, PeerConnectionStatus, PeerConnectionStatus::*, PeerInfo};
|
||||
pub use peer_sync_status::{PeerSyncStatus, SyncInfo};
|
||||
use score::{PeerAction, ScoreState};
|
||||
use std::collections::HashMap;
|
||||
@@ -623,16 +623,18 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
slog::crit!(self.log, "Connection has been allowed to a banned peer"; "peer_id" => peer_id.to_string());
|
||||
}
|
||||
|
||||
let enr = self.discovery.enr_of_peer(peer_id);
|
||||
|
||||
match connection {
|
||||
ConnectingType::Dialing => {
|
||||
peerdb.dialing_peer(peer_id);
|
||||
peerdb.dialing_peer(peer_id, enr);
|
||||
return true;
|
||||
}
|
||||
ConnectingType::IngoingConnected { multiaddr } => {
|
||||
peerdb.connect_outgoing(peer_id, multiaddr)
|
||||
peerdb.connect_outgoing(peer_id, multiaddr, enr)
|
||||
}
|
||||
ConnectingType::OutgoingConnected { multiaddr } => {
|
||||
peerdb.connect_ingoing(peer_id, multiaddr)
|
||||
peerdb.connect_ingoing(peer_id, multiaddr, enr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user