mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
Load the state corresponding to head payload status yay
This commit is contained in:
@@ -45,7 +45,7 @@ use tree_hash::TreeHash;
|
||||
use types::data::CustodyIndex;
|
||||
use types::{
|
||||
BeaconBlock, BeaconState, BlobSidecarList, ChainSpec, ColumnIndex, DataColumnSidecarList,
|
||||
Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot, StatePayloadStatus,
|
||||
Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot,
|
||||
};
|
||||
|
||||
/// An empty struct used to "witness" all the `BeaconChainTypes` traits. It has no user-facing
|
||||
@@ -786,13 +786,12 @@ where
|
||||
.map_err(|e| descriptive_db_error("head block", &e))?
|
||||
.ok_or("Head block not found in store")?;
|
||||
|
||||
// TODO(gloas): update head loading to load Full block once fork choice works
|
||||
let payload_status = StatePayloadStatus::Pending;
|
||||
let state_payload_status = head_payload_status.as_state_payload_status();
|
||||
|
||||
let (_head_state_root, head_state) = store
|
||||
.get_advanced_hot_state(
|
||||
head_block_root,
|
||||
payload_status,
|
||||
state_payload_status,
|
||||
current_slot,
|
||||
head_block.state_root(),
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::{
|
||||
};
|
||||
use types::{
|
||||
AttestationShufflingId, ChainSpec, Checkpoint, Epoch, EthSpec, ExecutionBlockHash, Hash256,
|
||||
Slot,
|
||||
Slot, StatePayloadStatus,
|
||||
};
|
||||
|
||||
pub const DEFAULT_PRUNE_THRESHOLD: usize = 256;
|
||||
@@ -69,6 +69,19 @@ pub enum PayloadStatus {
|
||||
Pending = 2,
|
||||
}
|
||||
|
||||
impl PayloadStatus {
|
||||
/// Convert a `PayloadStatus` into the equivalent `StatePayloadStatus`.
|
||||
///
|
||||
/// This maps `Empty` onto `StatePayloadStatus::Pending` because empty and pending fork choice
|
||||
/// nodes correspond to the exact same state.
|
||||
pub fn as_state_payload_status(self) -> StatePayloadStatus {
|
||||
match self {
|
||||
Self::Empty | Self::Pending => StatePayloadStatus::Pending,
|
||||
Self::Full => StatePayloadStatus::Full,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Spec's `ForkChoiceNode` augmented with ProtoNode index.
|
||||
pub struct IndexedForkChoiceNode {
|
||||
pub root: Hash256,
|
||||
|
||||
Reference in New Issue
Block a user