mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Update HTTP API docs (#1010)
This commit is contained in:
@@ -10,6 +10,7 @@ pub mod config;
|
||||
mod consensus;
|
||||
mod error;
|
||||
mod helpers;
|
||||
mod lighthouse;
|
||||
mod metrics;
|
||||
mod network;
|
||||
mod node;
|
||||
|
||||
13
beacon_node/rest_api/src/lighthouse.rs
Normal file
13
beacon_node/rest_api/src/lighthouse.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! This contains a collection of lighthouse specific HTTP endpoints.
|
||||
|
||||
use crate::response_builder::ResponseBuilder;
|
||||
use crate::ApiResult;
|
||||
use eth2_libp2p::NetworkGlobals;
|
||||
use hyper::{Body, Request};
|
||||
use std::sync::Arc;
|
||||
use types::EthSpec;
|
||||
|
||||
/// The syncing state of the beacon node.
|
||||
pub fn syncing<T: EthSpec>(req: Request<Body>, network: Arc<NetworkGlobals<T>>) -> ApiResult {
|
||||
ResponseBuilder::new(&req)?.body_no_ssz(&network.sync_state())
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
advanced, beacon, consensus, error::ApiError, helpers, metrics, network, node, spec, validator,
|
||||
BoxFut, NetworkChannel,
|
||||
advanced, beacon, consensus, error::ApiError, helpers, lighthouse, metrics, network, node,
|
||||
spec, validator, BoxFut, NetworkChannel,
|
||||
};
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use eth2_config::Eth2Config;
|
||||
@@ -57,9 +57,6 @@ pub fn route<T: BeaconChainTypes>(
|
||||
current_slot,
|
||||
))
|
||||
}
|
||||
(&Method::GET, "/node/lighthouse_syncing") => {
|
||||
into_boxfut(node::lighthouse_syncing::<T::EthSpec>(req, network_globals))
|
||||
}
|
||||
|
||||
// Methods for Network
|
||||
(&Method::GET, "/network/enr") => {
|
||||
@@ -214,6 +211,11 @@ pub fn route<T: BeaconChainTypes>(
|
||||
freezer_db_path,
|
||||
)),
|
||||
|
||||
// Lighthouse specific
|
||||
(&Method::GET, "/lighthouse/syncing") => {
|
||||
into_boxfut(lighthouse::syncing::<T::EthSpec>(req, network_globals))
|
||||
}
|
||||
|
||||
_ => Box::new(futures::future::err(ApiError::NotFound(
|
||||
"Request path and/or method not found.".to_owned(),
|
||||
))),
|
||||
|
||||
Reference in New Issue
Block a user