mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
clean up gloas-payload-cache
This commit is contained in:
@@ -3352,7 +3352,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
self.emit_sse_data_column_sidecar_events(
|
||||
slot,
|
||||
&block_root,
|
||||
data_columns.iter().map(|column| column.as_data_column()),
|
||||
);
|
||||
@@ -3430,7 +3429,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
);
|
||||
|
||||
self.emit_sse_data_column_sidecar_events(
|
||||
slot,
|
||||
&block_root,
|
||||
merge_result
|
||||
.full_columns
|
||||
@@ -3536,7 +3534,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
EngineGetBlobsOutput::CustodyColumns(columns) => {
|
||||
self.emit_sse_data_column_sidecar_events(
|
||||
slot,
|
||||
&block_root,
|
||||
columns.iter().map(|column| column.as_data_column()),
|
||||
);
|
||||
@@ -3570,7 +3567,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
fn emit_sse_data_column_sidecar_events<'a, I>(
|
||||
self: &Arc<Self>,
|
||||
slot: Slot,
|
||||
block_root: &Hash256,
|
||||
data_columns_iter: I,
|
||||
) where
|
||||
@@ -3579,6 +3575,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if let Some(event_handler) = self.event_handler.as_ref()
|
||||
&& event_handler.has_data_column_sidecar_subscribers()
|
||||
{
|
||||
let mut data_columns_iter = data_columns_iter.peekable();
|
||||
let Some(slot) = data_columns_iter.peek().map(|col| col.slot()) else {
|
||||
return;
|
||||
};
|
||||
let imported_data_columns = self
|
||||
.cached_data_column_indexes(block_root, slot)
|
||||
.unwrap_or_default();
|
||||
@@ -3643,7 +3643,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
self.emit_sse_data_column_sidecar_events(
|
||||
slot,
|
||||
&block_root,
|
||||
custody_columns.iter().map(|column| column.as_ref()),
|
||||
);
|
||||
|
||||
@@ -487,7 +487,7 @@ impl<T: BeaconChainTypes> PendingPayloadCache<T> {
|
||||
return ReconstructColumnsDecision::No("block already imported");
|
||||
};
|
||||
|
||||
let epoch = pending_components.epoch();
|
||||
let epoch = pending_components.bid.epoch();
|
||||
|
||||
let total_column_count = T::EthSpec::number_of_columns();
|
||||
let sampling_column_count = self
|
||||
@@ -524,7 +524,7 @@ impl<T: BeaconChainTypes> PendingPayloadCache<T> {
|
||||
let mut write_lock = self.availability_cache.write();
|
||||
let mut keys_to_remove = vec![];
|
||||
for (key, value) in write_lock.iter() {
|
||||
if value.epoch() < cutoff_epoch {
|
||||
if value.bid.epoch() < cutoff_epoch {
|
||||
keys_to_remove.push(*key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use std::sync::Arc;
|
||||
use tracing::{Span, debug, debug_span};
|
||||
use types::DataColumnSidecar;
|
||||
use types::{
|
||||
AbstractExecPayload, BeaconStateError, ColumnIndex, Epoch, EthSpec, Hash256, SignedBeaconBlock,
|
||||
AbstractExecPayload, BeaconStateError, ColumnIndex, EthSpec, Hash256, SignedBeaconBlock,
|
||||
SignedExecutionPayloadBid,
|
||||
};
|
||||
|
||||
@@ -187,11 +187,6 @@ impl<E: EthSpec> PendingComponents<E> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the epoch of the bid or first data column, if available.
|
||||
pub fn epoch(&self) -> Epoch {
|
||||
self.bid.message.slot.epoch(E::slots_per_epoch())
|
||||
}
|
||||
|
||||
pub fn status_str(&self, num_expected_columns: usize) -> String {
|
||||
format!(
|
||||
"envelope {}, data_columns {}/{}",
|
||||
|
||||
@@ -25,6 +25,14 @@ pub struct SignedExecutionPayloadBid<E: EthSpec> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> SignedExecutionPayloadBid<E> {
|
||||
pub fn epoch(&self) -> crate::Epoch {
|
||||
self.message.slot.epoch(E::slots_per_epoch())
|
||||
}
|
||||
|
||||
pub fn slot(&self) -> crate::Slot {
|
||||
self.message.slot
|
||||
}
|
||||
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
message: ExecutionPayloadBid::default(),
|
||||
|
||||
Reference in New Issue
Block a user