mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Fork schedule api (#2525)
## Issue Addressed Resolves #2524 ## Proposed Changes - Return all known forks in the `/config/fork_schedule`, previously returned only the head of the chain's fork. - Deleted the `StateId::head` method because it was only previously used in this endpoint. Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ use tokio::sync::mpsc::UnboundedSender;
|
||||
use tokio_stream::{wrappers::BroadcastStream, StreamExt};
|
||||
use types::{
|
||||
Attestation, AttesterSlashing, BeaconStateError, CommitteeCache, ConfigAndPreset, Epoch,
|
||||
EthSpec, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof, SignedBeaconBlock,
|
||||
EthSpec, ForkName, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof, SignedBeaconBlock,
|
||||
SignedContributionAndProof, SignedVoluntaryExit, Slot, SyncCommitteeMessage,
|
||||
SyncContributionData,
|
||||
};
|
||||
@@ -1366,7 +1366,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
);
|
||||
|
||||
/*
|
||||
* config/fork_schedule
|
||||
* config
|
||||
*/
|
||||
|
||||
let config_path = eth1_v1.and(warp::path("config"));
|
||||
@@ -1378,9 +1378,11 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and(chain_filter.clone())
|
||||
.and_then(|chain: Arc<BeaconChain<T>>| {
|
||||
blocking_json_task(move || {
|
||||
StateId::head()
|
||||
.fork(&chain)
|
||||
.map(|fork| api_types::GenericResponse::from(vec![fork]))
|
||||
let forks = ForkName::list_all()
|
||||
.into_iter()
|
||||
.filter_map(|fork_name| chain.spec.fork_for_name(fork_name))
|
||||
.collect::<Vec<_>>();
|
||||
Ok(api_types::GenericResponse::from(forks))
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user