chore(transaction-pool): remove duplicate code (#13627)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
DevOrbitlabs
2025-01-31 20:28:06 +07:00
committed by GitHub
parent 6afededdbf
commit 2d3bbb327d
2 changed files with 4 additions and 19 deletions

View File

@ -133,17 +133,9 @@ impl BlobStore for DiskFileBlobStore {
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
let mut result = vec![None; versioned_hashes.len()];
for (_tx_hash, blob_sidecar) in self.inner.blob_cache.lock().iter() {
for (i, blob_versioned_hash) in blob_sidecar.versioned_hashes().enumerate() {
for (j, target_versioned_hash) in versioned_hashes.iter().enumerate() {
if blob_versioned_hash == *target_versioned_hash {
result[j].get_or_insert_with(|| BlobAndProofV1 {
blob: Box::new(blob_sidecar.blobs[i]),
proof: blob_sidecar.proofs[i],
});
}
}
for (hash_idx, match_result) in blob_sidecar.match_versioned_hashes(versioned_hashes) {
result[hash_idx] = Some(match_result);
}
// Return early if all blobs are found.
if result.iter().all(|blob| blob.is_some()) {
break;

View File

@ -103,15 +103,8 @@ impl BlobStore for InMemoryBlobStore {
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
let mut result = vec![None; versioned_hashes.len()];
for (_tx_hash, blob_sidecar) in self.inner.store.read().iter() {
for (i, blob_versioned_hash) in blob_sidecar.versioned_hashes().enumerate() {
for (j, target_versioned_hash) in versioned_hashes.iter().enumerate() {
if blob_versioned_hash == *target_versioned_hash {
result[j].get_or_insert_with(|| BlobAndProofV1 {
blob: Box::new(blob_sidecar.blobs[i]),
proof: blob_sidecar.proofs[i],
});
}
}
for (hash_idx, match_result) in blob_sidecar.match_versioned_hashes(versioned_hashes) {
result[hash_idx] = Some(match_result);
}
// Return early if all blobs are found.