mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 23:08:23 +00:00
implement scoring mechanisms and plumbing
This commit is contained in:
@@ -9,10 +9,10 @@ use superstruct::superstruct;
|
||||
use types::Hash256;
|
||||
|
||||
// If adding a new version you should update this type alias and fix the breakages.
|
||||
pub type PersistedForkChoice = PersistedForkChoiceV28;
|
||||
pub type PersistedForkChoice = PersistedForkChoiceV29;
|
||||
|
||||
#[superstruct(
|
||||
variants(V17, V28),
|
||||
variants(V17, V28, V29),
|
||||
variant_attributes(derive(Encode, Decode)),
|
||||
no_enum
|
||||
)]
|
||||
@@ -20,10 +20,12 @@ pub struct PersistedForkChoice {
|
||||
#[superstruct(only(V17))]
|
||||
pub fork_choice_v17: fork_choice::PersistedForkChoiceV17,
|
||||
#[superstruct(only(V28))]
|
||||
pub fork_choice: fork_choice::PersistedForkChoiceV28,
|
||||
pub fork_choice_v28: fork_choice::PersistedForkChoiceV28,
|
||||
#[superstruct(only(V29))]
|
||||
pub fork_choice: fork_choice::PersistedForkChoiceV29,
|
||||
#[superstruct(only(V17))]
|
||||
pub fork_choice_store_v17: PersistedForkChoiceStoreV17,
|
||||
#[superstruct(only(V28))]
|
||||
#[superstruct(only(V28, V29))]
|
||||
pub fork_choice_store: PersistedForkChoiceStoreV28,
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ macro_rules! impl_store_item {
|
||||
|
||||
impl_store_item!(PersistedForkChoiceV17);
|
||||
|
||||
impl PersistedForkChoiceV28 {
|
||||
impl PersistedForkChoiceV29 {
|
||||
pub fn from_bytes(bytes: &[u8], store_config: &StoreConfig) -> Result<Self, Error> {
|
||||
let decompressed_bytes = store_config
|
||||
.decompress_bytes(bytes)
|
||||
@@ -78,3 +80,12 @@ impl PersistedForkChoiceV28 {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PersistedForkChoiceV28> for PersistedForkChoiceV29 {
|
||||
fn from(v28: PersistedForkChoiceV28) -> Self {
|
||||
Self {
|
||||
fork_choice: v28.fork_choice_v28.into(),
|
||||
fork_choice_store: v28.fork_choice_store,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user