mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 21:38:31 +00:00
Store states efficiently in the hot database (#746)
* Sparse hot DB and block root tree * Fix store_tests * Ensure loads of hot states on boundaries are fast * Milder error for unaligned finalized blocks
This commit is contained in:
@@ -120,7 +120,7 @@ impl<'a, E: EthSpec, S: Store<E>> ParentRootBlockIterator<'a, E, S> {
|
||||
}
|
||||
|
||||
impl<'a, E: EthSpec, S: Store<E>> Iterator for ParentRootBlockIterator<'a, E, S> {
|
||||
type Item = BeaconBlock<E>;
|
||||
type Item = (Hash256, BeaconBlock<E>);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
// Stop once we reach the zero parent, otherwise we'll keep returning the genesis
|
||||
@@ -128,9 +128,10 @@ impl<'a, E: EthSpec, S: Store<E>> Iterator for ParentRootBlockIterator<'a, E, S>
|
||||
if self.next_block_root.is_zero() {
|
||||
None
|
||||
} else {
|
||||
let block: BeaconBlock<E> = self.store.get(&self.next_block_root).ok()??;
|
||||
let block_root = self.next_block_root;
|
||||
let block: BeaconBlock<E> = self.store.get(&block_root).ok()??;
|
||||
self.next_block_root = block.parent_root;
|
||||
Some(block)
|
||||
Some((block_root, block))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user