cargo fmt & lint-fix

This commit is contained in:
qu0b 2023-07-26 11:22:06 +02:00
parent 1be4d54035
commit 28de041527
3 changed files with 7 additions and 17 deletions

View File

@ -1105,7 +1105,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
) -> Result<BlobSidecarList<T::EthSpec>, Error> {
self.early_attester_cache
.get_blobs(*block_root)
.map_or_else(|| self.get_blobs(block_root), |blobs| Ok(blobs))
.map_or_else(|| self.get_blobs(block_root), Ok)
}
/// Returns the block at the given root, if any.
@ -1185,15 +1185,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// - block and blobs are inconsistent in the database
/// - this method is called with a pre-deneb block root
/// - this method is called for a blob that is beyond the prune depth
pub fn get_blobs(
&self,
block_root: &Hash256,
) -> Result<BlobSidecarList<T::EthSpec>, Error> {
pub fn get_blobs(&self, block_root: &Hash256) -> Result<BlobSidecarList<T::EthSpec>, Error> {
match self.store.get_blobs(block_root)? {
Some(blobs) => Ok(blobs),
None => {
Ok(BlobSidecarList::default())
}
None => Ok(BlobSidecarList::default()),
}
}

View File

@ -258,9 +258,9 @@ impl BlockId {
chain: &BeaconChain<T>,
) -> Result<BlobSidecarList<T::EthSpec>, warp::Rejection> {
let root = self.root(chain)?.0;
chain.get_blobs(&root).map_err(
|e| warp_utils::reject::beacon_chain_error(e)
)
chain
.get_blobs(&root)
.map_err(warp_utils::reject::beacon_chain_error)
}
pub async fn blob_sidecar_list_filtered<T: BeaconChainTypes>(

View File

@ -1087,12 +1087,7 @@ async fn test_blobs_by_range() {
.block_root_at_slot(Slot::new(slot), WhenSlotSkipped::None)
.unwrap();
blob_count += root
.and_then(|root| {
rig.chain
.get_blobs(&root)
.unwrap_or_default()
.map(|blobs| blobs.len())
})
.map(|root| rig.chain.get_blobs(&root).unwrap_or_default().len())
.unwrap_or(0);
}
let mut actual_count = 0;