mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 12:22:51 +00:00
Implement PeerDAS RPC handlers (#6237)
* Implement PeerDAS RPC handlers * use terminate_response_stream * Merge branch 'unstable' of https://github.com/sigp/lighthouse into peerdas-network-rpc-handler * cargo fmt
This commit is contained in:
@@ -13,7 +13,10 @@ use ssz_types::{FixedVector, VariableList};
|
||||
use std::num::NonZeroUsize;
|
||||
use std::sync::Arc;
|
||||
use types::blob_sidecar::BlobIdentifier;
|
||||
use types::{BlobSidecar, ChainSpec, ColumnIndex, Epoch, EthSpec, Hash256, SignedBeaconBlock};
|
||||
use types::{
|
||||
BlobSidecar, ChainSpec, ColumnIndex, DataColumnIdentifier, DataColumnSidecar, Epoch, EthSpec,
|
||||
Hash256, SignedBeaconBlock,
|
||||
};
|
||||
|
||||
/// This represents the components of a partially available block
|
||||
///
|
||||
@@ -389,6 +392,22 @@ impl<T: BeaconChainTypes> DataAvailabilityCheckerInner<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetch a data column from the cache without affecting the LRU ordering
|
||||
pub fn peek_data_column(
|
||||
&self,
|
||||
data_column_id: &DataColumnIdentifier,
|
||||
) -> Result<Option<Arc<DataColumnSidecar<T::EthSpec>>>, AvailabilityCheckError> {
|
||||
if let Some(pending_components) = self.critical.read().peek(&data_column_id.block_root) {
|
||||
Ok(pending_components
|
||||
.verified_data_columns
|
||||
.iter()
|
||||
.find(|data_column| data_column.as_data_column().index == data_column_id.index)
|
||||
.map(|data_column| data_column.clone_arc()))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn peek_pending_components<R, F: FnOnce(Option<&PendingComponents<T::EthSpec>>) -> R>(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
|
||||
Reference in New Issue
Block a user