Skip to content

Commit

Permalink
use alloy fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jan 31, 2025
1 parent 678a164 commit e9c38c3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 38 deletions.
11 changes: 3 additions & 8 deletions crates/transaction-pool/src/blobstore/disk.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! A simple diskstore for blobs
use crate::blobstore::{
helpers::match_versioned_hashes, BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize,
};
use crate::blobstore::{BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize};
use alloy_eips::eip4844::{BlobAndProofV1, BlobTransactionSidecar};
use alloy_primitives::{TxHash, B256};
use parking_lot::{Mutex, RwLock};
Expand Down Expand Up @@ -135,11 +133,8 @@ 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() {
let matches = match_versioned_hashes(blob_sidecar, versioned_hashes);
for (i, match_result) in matches.into_iter().enumerate() {
if match_result.is_some() {
result[i] = match_result;
}
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()) {
Expand Down
21 changes: 0 additions & 21 deletions crates/transaction-pool/src/blobstore/helpers.rs

This file was deleted.

11 changes: 3 additions & 8 deletions crates/transaction-pool/src/blobstore/mem.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::blobstore::{
helpers::match_versioned_hashes, BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize,
};
use crate::blobstore::{BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize};
use alloy_eips::eip4844::{BlobAndProofV1, BlobTransactionSidecar};
use alloy_primitives::B256;
use parking_lot::RwLock;
Expand Down Expand Up @@ -105,11 +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() {
let matches = match_versioned_hashes(blob_sidecar, versioned_hashes);
for (i, match_result) in matches.into_iter().enumerate() {
if match_result.is_some() {
result[i] = match_result;
}
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.
Expand Down
1 change: 0 additions & 1 deletion crates/transaction-pool/src/blobstore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use std::{
pub use tracker::{BlobStoreCanonTracker, BlobStoreUpdates};

pub mod disk;
mod helpers;
mod mem;
mod noop;
mod tracker;
Expand Down

0 comments on commit e9c38c3

Please sign in to comment.