mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-09 03:17:55 +00:00
Import gossip data column into data availability checker (#6197)
* Import gossip data column into data availability checker
This commit is contained in:
@@ -22,6 +22,7 @@ pub struct CacheItem<E: EthSpec> {
|
||||
*/
|
||||
block: Arc<SignedBeaconBlock<E>>,
|
||||
blobs: Option<BlobSidecarList<E>>,
|
||||
data_columns: Option<DataColumnSidecarList<E>>,
|
||||
proto_block: ProtoBlock,
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
||||
},
|
||||
};
|
||||
|
||||
let (_, block, blobs) = block.deconstruct();
|
||||
let (_, block, blobs, data_columns) = block.deconstruct();
|
||||
let item = CacheItem {
|
||||
epoch,
|
||||
committee_lengths,
|
||||
@@ -78,6 +79,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
||||
target,
|
||||
block,
|
||||
blobs,
|
||||
data_columns,
|
||||
proto_block,
|
||||
};
|
||||
|
||||
@@ -164,6 +166,15 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
||||
.and_then(|item| item.blobs.clone())
|
||||
}
|
||||
|
||||
/// Returns the data columns, if `block_root` matches the cached item.
|
||||
pub fn get_data_columns(&self, block_root: Hash256) -> Option<DataColumnSidecarList<E>> {
|
||||
self.item
|
||||
.read()
|
||||
.as_ref()
|
||||
.filter(|item| item.beacon_block_root == block_root)
|
||||
.and_then(|item| item.data_columns.clone())
|
||||
}
|
||||
|
||||
/// Returns the proto-array block, if `block_root` matches the cached item.
|
||||
pub fn get_proto_block(&self, block_root: Hash256) -> Option<ProtoBlock> {
|
||||
self.item
|
||||
|
||||
Reference in New Issue
Block a user