mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-29 10:43:42 +00:00
Load block roots from fork choice where possible when serving BlocksByRange requests (#7058)
* Load block roots from fork choice where possible to avoid loading state from disk when serving block by range requests. * Check if the start slot is newer than finalization (`start_slot >= finalized_slot`), and use fork choice in that case.
This commit is contained in:
@@ -856,10 +856,18 @@ impl ProtoArrayForkChoice {
|
||||
}
|
||||
|
||||
/// See `ProtoArray::iter_nodes`
|
||||
pub fn iter_nodes<'a>(&'a self, block_root: &Hash256) -> Iter<'a> {
|
||||
pub fn iter_nodes(&self, block_root: &Hash256) -> Iter {
|
||||
self.proto_array.iter_nodes(block_root)
|
||||
}
|
||||
|
||||
/// See `ProtoArray::iter_block_roots`
|
||||
pub fn iter_block_roots(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
) -> impl Iterator<Item = (Hash256, Slot)> + use<'_> {
|
||||
self.proto_array.iter_block_roots(block_root)
|
||||
}
|
||||
|
||||
pub fn as_bytes(&self) -> Vec<u8> {
|
||||
SszContainer::from(self).as_ssz_bytes()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user