mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-29 20:27:14 +00:00
remove option & remove block check
This commit is contained in:
@@ -1102,10 +1102,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
pub fn get_blobs_checking_early_attester_cache(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
) -> Result<Option<BlobSidecarList<T::EthSpec>>, Error> {
|
||||
) -> Result<BlobSidecarList<T::EthSpec>, Error> {
|
||||
self.early_attester_cache
|
||||
.get_blobs(*block_root)
|
||||
.map_or_else(|| self.get_blobs(block_root), |blobs| Ok(Some(blobs)))
|
||||
.map_or_else(|| self.get_blobs(block_root), |blobs| Ok(blobs))
|
||||
}
|
||||
|
||||
/// Returns the block at the given root, if any.
|
||||
@@ -1188,18 +1188,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
pub fn get_blobs(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
) -> Result<Option<BlobSidecarList<T::EthSpec>>, Error> {
|
||||
|
||||
let blobs = self.store.get_blobs(block_root)?;
|
||||
match Some(blobs) {
|
||||
) -> Result<BlobSidecarList<T::EthSpec>, Error> {
|
||||
match self.store.get_blobs(block_root)? {
|
||||
Some(blobs) => Ok(blobs),
|
||||
None => {
|
||||
// if there are no blobs, but a block exists return an empty list
|
||||
if let Some(_) = self.store.try_get_full_block(block_root)? {
|
||||
return Ok(Some(BlobSidecarList::default()))
|
||||
}
|
||||
// if there is no blob and no block return none.
|
||||
Ok(None)
|
||||
Ok(BlobSidecarList::default())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,14 +698,14 @@ where
|
||||
let block = self.chain.head_beacon_block();
|
||||
let block_root = block.canonical_root();
|
||||
let blobs = self.chain.get_blobs(&block_root).unwrap();
|
||||
RpcBlock::new(block, blobs).unwrap()
|
||||
RpcBlock::new(block, Some(blobs)).unwrap()
|
||||
}
|
||||
|
||||
pub fn get_full_block(&self, block_root: &Hash256) -> RpcBlock<E> {
|
||||
let block = self.chain.get_blinded_block(block_root).unwrap().unwrap();
|
||||
let full_block = self.chain.store.make_full_block(block_root, block).unwrap();
|
||||
let blobs = self.chain.get_blobs(block_root).unwrap();
|
||||
RpcBlock::new(Arc::new(full_block), blobs).unwrap()
|
||||
RpcBlock::new(Arc::new(full_block), Some(blobs)).unwrap()
|
||||
}
|
||||
|
||||
pub fn get_all_validators(&self) -> Vec<usize> {
|
||||
|
||||
Reference in New Issue
Block a user