mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Add API endpoint for fork choice
This commit is contained in:
@@ -29,6 +29,7 @@ pub enum Error {
|
||||
UnknownBlockSlot(Hash256),
|
||||
UnknownJustifiedBlock(Hash256),
|
||||
UnknownJustifiedState(Hash256),
|
||||
UnableToJsonEncode(String),
|
||||
}
|
||||
|
||||
pub struct ForkChoice<T: BeaconChainTypes> {
|
||||
@@ -230,6 +231,10 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
self.backend.maybe_prune(finalized_root).map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn as_json(&self) -> Result<String> {
|
||||
self.backend.as_json().map_err(Error::UnableToJsonEncode)
|
||||
}
|
||||
|
||||
/// Returns a `SszForkChoice` which contains the current state of `Self`.
|
||||
pub fn as_ssz_container(&self) -> SszForkChoice {
|
||||
SszForkChoice {
|
||||
|
||||
Reference in New Issue
Block a user