Skip to content

Commit cb4f404

Browse files
committed
fix: avoid iterating the cache
1 parent b947df8 commit cb4f404

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/providers/src/l1/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ impl<P: L1MessageProvider + Sync> L1Provider for OnlineL1Provider<P> {
9999
hash: B256,
100100
) -> Result<Option<Arc<Blob>>, L1ProviderError> {
101101
// check if the requested blob is in the cache.
102-
let cache = self.cache.lock().await;
103-
if let Some((_, blob)) = cache.iter().find(|c| c.0 == &hash) {
102+
let mut cache = self.cache.lock().await;
103+
if let Some(blob) = cache.get(&hash) {
104104
return Ok(Some(blob.clone()));
105105
}
106106
// avoid holding the lock over the blob request.

0 commit comments

Comments
 (0)