mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(transaction-pool): remove duplicate code (#13627)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -133,17 +133,9 @@ impl BlobStore for DiskFileBlobStore {
|
|||||||
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
|
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
|
||||||
let mut result = vec![None; versioned_hashes.len()];
|
let mut result = vec![None; versioned_hashes.len()];
|
||||||
for (_tx_hash, blob_sidecar) in self.inner.blob_cache.lock().iter() {
|
for (_tx_hash, blob_sidecar) in self.inner.blob_cache.lock().iter() {
|
||||||
for (i, blob_versioned_hash) in blob_sidecar.versioned_hashes().enumerate() {
|
for (hash_idx, match_result) in blob_sidecar.match_versioned_hashes(versioned_hashes) {
|
||||||
for (j, target_versioned_hash) in versioned_hashes.iter().enumerate() {
|
result[hash_idx] = Some(match_result);
|
||||||
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],
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return early if all blobs are found.
|
// Return early if all blobs are found.
|
||||||
if result.iter().all(|blob| blob.is_some()) {
|
if result.iter().all(|blob| blob.is_some()) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -103,15 +103,8 @@ impl BlobStore for InMemoryBlobStore {
|
|||||||
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
|
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
|
||||||
let mut result = vec![None; versioned_hashes.len()];
|
let mut result = vec![None; versioned_hashes.len()];
|
||||||
for (_tx_hash, blob_sidecar) in self.inner.store.read().iter() {
|
for (_tx_hash, blob_sidecar) in self.inner.store.read().iter() {
|
||||||
for (i, blob_versioned_hash) in blob_sidecar.versioned_hashes().enumerate() {
|
for (hash_idx, match_result) in blob_sidecar.match_versioned_hashes(versioned_hashes) {
|
||||||
for (j, target_versioned_hash) in versioned_hashes.iter().enumerate() {
|
result[hash_idx] = Some(match_result);
|
||||||
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],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return early if all blobs are found.
|
// Return early if all blobs are found.
|
||||||
|
|||||||
Reference in New Issue
Block a user