Skip to content

Commit

Permalink
perf: check block cache for requested header (#13890)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 20, 2025
1 parent 93d6f80 commit 21761ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/rpc/rpc-eth-types/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ where
continue
}

// it's possible we have the entire block cached
if let Some(block) = this.full_block_cache.get(&block_hash) {
let _ = response_tx.send(Ok(block.clone_header()));
continue
}

// header is not in the cache, request it if this is the first
// consumer
if this.headers_cache.queue(block_hash, response_tx) {
Expand Down

0 comments on commit 21761ad

Please sign in to comment.