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> { ) -> Result<BlobSidecarList<T::EthSpec>, Error> {
self.early_attester_cache self.early_attester_cache
.get_blobs(*block_root) .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. /// 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 /// - block and blobs are inconsistent in the database
/// - this method is called with a pre-deneb block root /// - this method is called with a pre-deneb block root
/// - this method is called for a blob that is beyond the prune depth /// - this method is called for a blob that is beyond the prune depth
pub fn get_blobs( pub fn get_blobs(&self, block_root: &Hash256) -> Result<BlobSidecarList<T::EthSpec>, Error> {
&self,
block_root: &Hash256,
) -> Result<BlobSidecarList<T::EthSpec>, Error> {
match self.store.get_blobs(block_root)? { match self.store.get_blobs(block_root)? {
Some(blobs) => Ok(blobs), Some(blobs) => Ok(blobs),
None => { None => Ok(BlobSidecarList::default()),
Ok(BlobSidecarList::default())
}
} }
} }

View File

@ -258,9 +258,9 @@ impl BlockId {
chain: &BeaconChain<T>, chain: &BeaconChain<T>,
) -> Result<BlobSidecarList<T::EthSpec>, warp::Rejection> { ) -> Result<BlobSidecarList<T::EthSpec>, warp::Rejection> {
let root = self.root(chain)?.0; let root = self.root(chain)?.0;
chain.get_blobs(&root).map_err( chain
|e| warp_utils::reject::beacon_chain_error(e) .get_blobs(&root)
) .map_err(warp_utils::reject::beacon_chain_error)
} }
pub async fn blob_sidecar_list_filtered<T: BeaconChainTypes>( 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) .block_root_at_slot(Slot::new(slot), WhenSlotSkipped::None)
.unwrap(); .unwrap();
blob_count += root blob_count += root
.and_then(|root| { .map(|root| rig.chain.get_blobs(&root).unwrap_or_default().len())
rig.chain
.get_blobs(&root)
.unwrap_or_default()
.map(|blobs| blobs.len())
})
.unwrap_or(0); .unwrap_or(0);
} }
let mut actual_count = 0; let mut actual_count = 0;