mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-29 18:53:32 +00:00
Global Sync access (#994)
* Connect sync logic to network globals * Add further sync info to sync status * Build new syncing HTTP API methods * Fix bug in updating sync state * Highest slot is current slot * Update book for syncing API
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
mod beacon;
|
||||
mod consensus;
|
||||
mod node;
|
||||
mod validator;
|
||||
|
||||
pub use beacon::{
|
||||
@@ -16,3 +17,5 @@ pub use validator::{
|
||||
};
|
||||
|
||||
pub use consensus::{IndividualVote, IndividualVotesRequest, IndividualVotesResponse};
|
||||
|
||||
pub use node::{SyncingResponse, SyncingStatus};
|
||||
|
||||
32
eth2/utils/rest_types/src/node.rs
Normal file
32
eth2/utils/rest_types/src/node.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
//! Collection of types for the /node HTTP
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use types::Slot;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Encode, Decode)]
|
||||
/// The current syncing status of the node.
|
||||
pub struct SyncingStatus {
|
||||
/// The starting slot of sync.
|
||||
///
|
||||
/// For a finalized sync, this is the start slot of the current finalized syncing
|
||||
/// chain.
|
||||
///
|
||||
/// For head sync this is the last finalized slot.
|
||||
pub starting_slot: Slot,
|
||||
/// The current slot.
|
||||
pub current_slot: Slot,
|
||||
/// The highest known slot. For the current syncing chain.
|
||||
///
|
||||
/// For a finalized sync, the target finalized slot.
|
||||
/// For head sync, this is the highest known slot of all head chains.
|
||||
pub highest_slot: Slot,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Encode, Decode)]
|
||||
/// The response for the /node/syncing HTTP GET.
|
||||
pub struct SyncingResponse {
|
||||
/// Is the node syncing.
|
||||
pub is_syncing: bool,
|
||||
/// The current sync status.
|
||||
pub sync_status: SyncingStatus,
|
||||
}
|
||||
Reference in New Issue
Block a user