refactor(txpool): small refactor in DiskFileBlobStoreInner get_exact (#11911)

This commit is contained in:
Thomas Coratger
2024-10-20 23:42:45 +02:00
committed by GitHub
parent a188597a3c
commit 0270128d4f

View File

@ -409,13 +409,9 @@ impl DiskFileBlobStoreInner {
/// Returns an error if there are any missing blobs.
#[inline]
fn get_exact(&self, txs: Vec<B256>) -> Result<Vec<BlobTransactionSidecar>, BlobStoreError> {
let mut res = Vec::with_capacity(txs.len());
for tx in txs {
let blob = self.get_one(tx)?.ok_or_else(|| BlobStoreError::MissingSidecar(tx))?;
res.push(blob)
}
Ok(res)
txs.into_iter()
.map(|tx| self.get_one(tx)?.ok_or(BlobStoreError::MissingSidecar(tx)))
.collect()
}
}