Skip to content

Commit

Permalink
perf: remove sidecar clone if no listeners (#11285)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Sep 27, 2024
1 parent 247f029 commit 098018d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/transaction-pool/src/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,11 @@ where

/// Notify all listeners about a blob sidecar for a newly inserted blob (eip4844) transaction.
fn on_new_blob_sidecar(&self, tx_hash: &TxHash, sidecar: &BlobTransactionSidecar) {
let sidecar = Arc::new(sidecar.clone());

let mut sidecar_listeners = self.blob_transaction_sidecar_listener.lock();
if sidecar_listeners.is_empty() {
return
}
let sidecar = Arc::new(sidecar.clone());
sidecar_listeners.retain_mut(|listener| {
let new_blob_event = NewBlobSidecar { tx_hash: *tx_hash, sidecar: sidecar.clone() };
match listener.sender.try_send(new_blob_event) {
Expand Down

0 comments on commit 098018d

Please sign in to comment.