mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 12:13:46 +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:
@@ -1444,6 +1444,12 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
.ok_or(Error::StateRootsOutOfBounds(i))
|
||||
}
|
||||
|
||||
/// Gets the state root for the start slot of some epoch.
|
||||
pub fn get_state_root_at_epoch_start(&self, epoch: Epoch) -> Result<Hash256, Error> {
|
||||
self.get_state_root(epoch.start_slot(E::slots_per_epoch()))
|
||||
.copied()
|
||||
}
|
||||
|
||||
/// Gets the oldest (earliest slot) state root.
|
||||
pub fn get_oldest_state_root(&self) -> Result<&Hash256, Error> {
|
||||
let oldest_slot = self.slot().saturating_sub(self.state_roots().len());
|
||||
|
||||
Reference in New Issue
Block a user