Delete unused incomplete_processing_components (#5418)

* Delete unused incomplete_processing_components

* lint
This commit is contained in:
Lion - dapplion
2024-03-23 09:00:35 +09:00
committed by GitHub
parent 332e1bb9e6
commit 306d3eb0eb
3 changed files with 12 additions and 46 deletions

View File

@@ -3,7 +3,7 @@ use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::sync::Arc;
use types::beacon_block_body::KzgCommitmentOpts;
use types::{EthSpec, Hash256, SignedBeaconBlock, Slot};
use types::{EthSpec, Hash256, SignedBeaconBlock};
/// This cache is used only for gossip blocks/blobs and single block/blob lookups, to give req/resp
/// a view of what we have and what we require. This cache serves a slightly different purpose than
@@ -29,23 +29,13 @@ impl<E: EthSpec> ProcessingCache<E> {
.get(block_root)
.map_or(false, |b| b.block_exists())
}
pub fn incomplete_processing_components(&self, slot: Slot) -> Vec<Hash256> {
let mut roots_missing_components = vec![];
for (&block_root, info) in self.processing_cache.iter() {
if info.slot == slot && !info.is_available() {
roots_missing_components.push(block_root);
}
}
roots_missing_components
}
pub fn len(&self) -> usize {
self.processing_cache.len()
}
}
#[derive(Debug, Clone)]
#[derive(Default, Debug, Clone)]
pub struct ProcessingComponents<E: EthSpec> {
slot: Slot,
/// Blobs required for a block can only be known if we have seen the block. So `Some` here
/// means we've seen it, a `None` means we haven't. The `kzg_commitments` value helps us figure
/// out whether incoming blobs actually match the block.
@@ -56,12 +46,8 @@ pub struct ProcessingComponents<E: EthSpec> {
}
impl<E: EthSpec> ProcessingComponents<E> {
pub fn new(slot: Slot) -> Self {
Self {
slot,
block: None,
blob_commitments: KzgCommitmentOpts::<E>::default(),
}
pub fn new() -> Self {
Self::default()
}
}
@@ -70,7 +56,6 @@ impl<E: EthSpec> ProcessingComponents<E> {
impl<E: EthSpec> ProcessingComponents<E> {
pub fn empty(_block_root: Hash256) -> Self {
Self {
slot: Slot::new(0),
block: None,
blob_commitments: KzgCommitmentOpts::<E>::default(),
}