mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Add debug fork choice api (#4003)
## Issue Addressed Which issue # does this PR address? https://github.com/sigp/lighthouse/issues/3669 ## Proposed Changes Please list or describe the changes introduced by this PR. - A new API to fetch fork choice data, as specified [here](https://github.com/ethereum/beacon-APIs/pull/232) - A new integration test to test the new API ## Additional Info Please provide any additional information. For example, future considerations or information useful for reviewers. - `extra_data` field specified in the beacon-API spec is not implemented, please let me know if I should instead. Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
@@ -10,7 +10,10 @@ use crate::{
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::collections::{BTreeSet, HashMap};
|
||||
use std::{
|
||||
collections::{BTreeSet, HashMap},
|
||||
fmt,
|
||||
};
|
||||
use types::{
|
||||
AttestationShufflingId, ChainSpec, Checkpoint, Epoch, EthSpec, ExecutionBlockHash, Hash256,
|
||||
Slot,
|
||||
@@ -125,6 +128,17 @@ impl ExecutionStatus {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ExecutionStatus {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
ExecutionStatus::Valid(_) => write!(f, "valid"),
|
||||
ExecutionStatus::Invalid(_) => write!(f, "invalid"),
|
||||
ExecutionStatus::Optimistic(_) => write!(f, "optimistic"),
|
||||
ExecutionStatus::Irrelevant(_) => write!(f, "irrelevant"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A block that is to be applied to the fork choice.
|
||||
///
|
||||
/// A simplified version of `types::BeaconBlock`.
|
||||
|
||||
Reference in New Issue
Block a user