mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Small fixes for the genesis state
This commit is contained in:
@@ -665,8 +665,11 @@ impl HierarchyModuli {
|
|||||||
payload_status: StatePayloadStatus,
|
payload_status: StatePayloadStatus,
|
||||||
) -> Result<StorageStrategy, Error> {
|
) -> Result<StorageStrategy, Error> {
|
||||||
// Store all Full states by replaying from their respective Pending state at the same slot.
|
// Store all Full states by replaying from their respective Pending state at the same slot.
|
||||||
|
// Make an exception for the genesis state, which "counts as" Full by virtue of having 0x0
|
||||||
|
// in both `latest_block_hash` and `latest_execution_payload_bid.block_hash`.
|
||||||
if let StatePayloadStatus::Full = payload_status
|
if let StatePayloadStatus::Full = payload_status
|
||||||
&& slot >= start_slot
|
&& slot >= start_slot
|
||||||
|
&& slot != 0
|
||||||
{
|
{
|
||||||
return Ok(StorageStrategy::ReplayFrom(slot));
|
return Ok(StorageStrategy::ReplayFrom(slot));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4199,11 +4199,11 @@ impl HotStateSummary {
|
|||||||
OptionalDiffBaseState::Snapshot(0)
|
OptionalDiffBaseState::Snapshot(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
let previous_state_root = if state.slot() == 0
|
let previous_state_root = if state.slot() == 0 {
|
||||||
&& let StatePayloadStatus::Pending = payload_status
|
|
||||||
{
|
|
||||||
// Set to 0x0 for genesis state to prevent any sort of circular reference.
|
// Set to 0x0 for genesis state to prevent any sort of circular reference.
|
||||||
Hash256::zero()
|
Hash256::zero()
|
||||||
|
} else if let StatePayloadStatus::Full = payload_status {
|
||||||
|
get_state_root(state.slot())?
|
||||||
} else {
|
} else {
|
||||||
get_state_root(state.slot().safe_sub(1_u64)?)?
|
get_state_root(state.slot().safe_sub(1_u64)?)?
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user