diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index eb1ee3276..b3790ce99 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -24,7 +24,7 @@ tokio = { version = "1", default-features = false, features = ["sync"] } aquamarine = "0.1" # docs thiserror = "1.0" tracing = "0.1" -serde = { version = "1.0", features = ["derive"] } +serde = { version = "1.0", features = ["derive", "rc"] } linked-hash-map = "0.5" fnv = "1.0.7" bitflags = "1.3" diff --git a/crates/transaction-pool/src/pool/events.rs b/crates/transaction-pool/src/pool/events.rs index ddae68454..7f9eec3e3 100644 --- a/crates/transaction-pool/src/pool/events.rs +++ b/crates/transaction-pool/src/pool/events.rs @@ -1,6 +1,7 @@ use crate::traits::PropagateKind; use reth_primitives::{TxHash, H256}; use serde::{Deserialize, Serialize}; +use std::sync::Arc; /// Various events that describe status changes of a transaction. #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] @@ -20,5 +21,5 @@ pub enum TransactionEvent { /// Transaction became invalid indefinitely. Invalid, /// Transaction was propagated to peers. - Propagated(Vec), + Propagated(Arc>), } diff --git a/crates/transaction-pool/src/pool/listener.rs b/crates/transaction-pool/src/pool/listener.rs index 6fa38a147..c8c1f26a3 100644 --- a/crates/transaction-pool/src/pool/listener.rs +++ b/crates/transaction-pool/src/pool/listener.rs @@ -2,7 +2,7 @@ use crate::{pool::events::TransactionEvent, traits::PropagateKind}; use reth_primitives::{rpc::TxHash, H256}; -use std::collections::HashMap; +use std::{collections::HashMap, sync::Arc}; use tokio::sync::mpsc::UnboundedSender; type EventBroadcast = UnboundedSender; @@ -111,7 +111,7 @@ impl PoolEventBroadcaster { /// Transaction was propagated. fn propagated(&mut self, peers: Vec) { - self.broadcast(TransactionEvent::Propagated(peers)); + self.broadcast(TransactionEvent::Propagated(Arc::new(peers))); } /// Transaction was replaced with the given transaction