mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 01:33:33 +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:
@@ -1155,6 +1155,25 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.map_or_else(|| self.get_blobs(block_root), Ok)
|
||||
}
|
||||
|
||||
pub fn get_data_column_checking_all_caches(
|
||||
&self,
|
||||
block_root: Hash256,
|
||||
index: ColumnIndex,
|
||||
) -> Result<Option<Arc<DataColumnSidecar<T::EthSpec>>>, Error> {
|
||||
if let Some(column) = self
|
||||
.data_availability_checker
|
||||
.get_data_column(&DataColumnIdentifier { block_root, index })?
|
||||
{
|
||||
return Ok(Some(column));
|
||||
}
|
||||
|
||||
if let Some(columns) = self.early_attester_cache.get_data_columns(block_root) {
|
||||
return Ok(columns.iter().find(|c| c.index == index).cloned());
|
||||
}
|
||||
|
||||
self.get_data_column(&block_root, &index)
|
||||
}
|
||||
|
||||
/// Returns the block at the given root, if any.
|
||||
///
|
||||
/// ## Errors
|
||||
@@ -1230,6 +1249,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the data columns at the given root, if any.
|
||||
///
|
||||
/// ## Errors
|
||||
/// May return a database error.
|
||||
pub fn get_data_column(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
column_index: &ColumnIndex,
|
||||
) -> Result<Option<Arc<DataColumnSidecar<T::EthSpec>>>, Error> {
|
||||
Ok(self.store.get_data_column(block_root, column_index)?)
|
||||
}
|
||||
|
||||
pub fn get_blinded_block(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
|
||||
Reference in New Issue
Block a user