mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf(txpool): Arc alloc transaction event (#279)
This commit is contained in:
@ -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"
|
||||
|
||||
@ -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<PropagateKind>),
|
||||
Propagated(Arc<Vec<PropagateKind>>),
|
||||
}
|
||||
|
||||
@ -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<TransactionEvent>;
|
||||
@ -111,7 +111,7 @@ impl PoolEventBroadcaster {
|
||||
|
||||
/// Transaction was propagated.
|
||||
fn propagated(&mut self, peers: Vec<PropagateKind>) {
|
||||
self.broadcast(TransactionEvent::Propagated(peers));
|
||||
self.broadcast(TransactionEvent::Propagated(Arc::new(peers)));
|
||||
}
|
||||
|
||||
/// Transaction was replaced with the given transaction
|
||||
|
||||
Reference in New Issue
Block a user