mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
use slot so we dont hit the cache twice
This commit is contained in:
@@ -1208,6 +1208,24 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cached_data_column_indexes(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
slot: Slot,
|
||||
) -> Option<Vec<ColumnIndex>> {
|
||||
if self
|
||||
.spec
|
||||
.fork_name_at_slot::<T::EthSpec>(slot)
|
||||
.gloas_enabled()
|
||||
{
|
||||
self.pending_payload_cache
|
||||
.cached_data_column_indexes(block_root)
|
||||
} else {
|
||||
self.data_availability_checker
|
||||
.cached_data_column_indexes(block_root)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the block at the given root, if any.
|
||||
///
|
||||
/// ## Errors
|
||||
@@ -3561,18 +3579,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if let Some(event_handler) = self.event_handler.as_ref()
|
||||
&& event_handler.has_data_column_sidecar_subscribers()
|
||||
{
|
||||
let imported_data_columns = if self
|
||||
.spec
|
||||
.fork_name_at_slot::<T::EthSpec>(slot)
|
||||
.gloas_enabled()
|
||||
{
|
||||
self.pending_payload_cache
|
||||
.cached_data_column_indexes(block_root)
|
||||
} else {
|
||||
self.data_availability_checker
|
||||
.cached_data_column_indexes(block_root)
|
||||
}
|
||||
.unwrap_or_default();
|
||||
let imported_data_columns = self
|
||||
.cached_data_column_indexes(block_root, slot)
|
||||
.unwrap_or_default();
|
||||
let new_data_columns =
|
||||
data_columns_iter.filter(|b| !imported_data_columns.contains(b.index()));
|
||||
|
||||
|
||||
@@ -119,15 +119,12 @@ impl<T: BeaconChainTypes> FetchBlobsBeaconAdapter<T> {
|
||||
.cached_blob_indexes(block_root)
|
||||
}
|
||||
|
||||
pub(crate) fn cached_data_column_indexes(&self, block_root: &Hash256) -> Option<Vec<u64>> {
|
||||
self.chain
|
||||
.data_availability_checker
|
||||
.cached_data_column_indexes(block_root)
|
||||
.or_else(|| {
|
||||
self.chain
|
||||
.pending_payload_cache
|
||||
.cached_data_column_indexes(block_root)
|
||||
})
|
||||
pub(crate) fn cached_data_column_indexes(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
slot: Slot,
|
||||
) -> Option<Vec<u64>> {
|
||||
self.chain.cached_data_column_indexes(block_root, slot)
|
||||
}
|
||||
|
||||
pub(crate) async fn process_engine_blobs(
|
||||
|
||||
@@ -445,7 +445,7 @@ async fn compute_custody_columns_to_import<T: BeaconChainTypes>(
|
||||
|
||||
// Only consider columns that are not already known to data availability.
|
||||
if let Some(known_columns) =
|
||||
chain_adapter_cloned.cached_data_column_indexes(&block_root)
|
||||
chain_adapter_cloned.cached_data_column_indexes(&block_root, header.slot())
|
||||
{
|
||||
custody_columns.retain(|col| !known_columns.contains(&col.index()));
|
||||
if custody_columns.is_empty() {
|
||||
|
||||
@@ -199,7 +199,7 @@ mod get_blobs_v2 {
|
||||
.returning(|_| None);
|
||||
mock_adapter
|
||||
.expect_cached_data_column_indexes()
|
||||
.returning(|_| None);
|
||||
.returning(|_, _| None);
|
||||
mock_process_engine_blobs_result(
|
||||
&mut mock_adapter,
|
||||
Ok(AvailabilityProcessingStatus::Imported(block_root)),
|
||||
|
||||
Reference in New Issue
Block a user