Ensure lookup sync checks caches correctly (#5840)

* Ensure lookup sync checks caches correctly

* fix tests and remove unused method

* Simplify BlockProcessStatus
This commit is contained in:
Lion - dapplion
2024-05-25 16:56:51 +02:00
committed by GitHub
parent f187ad8bb4
commit e4984217a6
9 changed files with 106 additions and 56 deletions

View File

@@ -86,17 +86,12 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
/// Checks if the block root is currenlty in the availability cache awaiting import because
/// of missing components.
pub fn has_execution_valid_block(&self, block_root: &Hash256) -> bool {
pub fn get_execution_valid_block(
&self,
block_root: &Hash256,
) -> Option<Arc<SignedBeaconBlock<T::EthSpec>>> {
self.availability_cache
.has_execution_valid_block(block_root)
}
/// Return the required blobs `block_root` expects if the block is currenlty in the cache.
pub fn num_expected_blobs(&self, block_root: &Hash256) -> Option<usize> {
self.availability_cache
.peek_pending_components(block_root, |components| {
components.and_then(|components| components.num_expected_blobs())
})
.get_execution_valid_block(block_root)
}
/// Return the set of imported blob indexes for `block_root`. Returns None if there is no block