Optionally check DB invariants at runtime (#8952)

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Lion - dapplion
2026-03-11 01:20:02 -05:00
committed by GitHub
parent 815040dc3c
commit 6350a27031
8 changed files with 918 additions and 0 deletions

View File

@@ -111,6 +111,19 @@ impl<E: EthSpec> StateCache<E> {
self.hdiff_buffers.mem_usage()
}
/// Return all state roots currently held in the cache, including the finalized state.
pub fn state_roots(&self) -> Vec<Hash256> {
let mut roots: Vec<Hash256> = self
.states
.iter()
.map(|(&state_root, _)| state_root)
.collect();
if let Some(ref finalized) = self.finalized_state {
roots.push(finalized.state_root);
}
roots
}
pub fn update_finalized_state(
&mut self,
state_root: Hash256,