mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Shrink persisted fork choice data (#7805)
Closes: - https://github.com/sigp/lighthouse/issues/7760 - [x] Remove `balances_cache` from `PersistedForkChoiceStore` (~65 MB saving on mainnet) - [x] Remove `justified_balances` from `PersistedForkChoiceStore` (~16 MB saving on mainnet) - [x] Remove `balances` from `ProtoArray`/`SszContainer`. - [x] Implement zstd compression for votes - [x] Fix bug in justified state usage - [x] Bump schema version to V28 and implement migration.
This commit is contained in:
@@ -355,6 +355,18 @@ impl StateSummariesDAG {
|
||||
}
|
||||
Ok(descendants)
|
||||
}
|
||||
|
||||
/// Returns the root of the state at `slot` with `latest_block_root`, if it exists.
|
||||
///
|
||||
/// The `slot` must be the slot of the `latest_block_root` or a skipped slot following it. This
|
||||
/// function will not return the `state_root` of a state with a different `latest_block_root`
|
||||
/// even if it lies on the same chain.
|
||||
pub fn state_root_at_slot(&self, latest_block_root: Hash256, slot: Slot) -> Option<Hash256> {
|
||||
self.state_summaries_by_block_root
|
||||
.get(&latest_block_root)?
|
||||
.get(&slot)
|
||||
.map(|(state_root, _)| *state_root)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HotStateSummary> for DAGStateSummary {
|
||||
|
||||
Reference in New Issue
Block a user