diff --git a/src/accounting_stage.rs b/src/accounting_stage.rs index 51fa2bbad..95fffd654 100644 --- a/src/accounting_stage.rs +++ b/src/accounting_stage.rs @@ -11,13 +11,13 @@ use result::Result; use signature::PublicKey; use std::net::{SocketAddr, UdpSocket}; use std::sync::mpsc::{channel, Receiver, Sender}; -use std::sync::Mutex; +use std::sync::{Arc, Mutex}; use transaction::Transaction; pub struct AccountingStage { pub output: Mutex>, entry_sender: Mutex>, - pub acc: Accountant, + pub acc: Arc, historian_input: Mutex>, historian: Mutex, entry_info_subscribers: Mutex>, @@ -32,7 +32,7 @@ impl AccountingStage { AccountingStage { output: Mutex::new(output), entry_sender: Mutex::new(entry_sender), - acc, + acc: Arc::new(acc), entry_info_subscribers: Mutex::new(vec![]), historian_input: Mutex::new(historian_input), historian: Mutex::new(historian), diff --git a/src/tpu.rs b/src/tpu.rs index 96984838b..0d984093c 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -1,6 +1,7 @@ //! The `tpu` module implements the Transaction Processing Unit, a //! 5-stage transaction processing pipeline in software. +use accountant::Accountant; use accounting_stage::{AccountingStage, Request, Response}; use bincode::{deserialize, serialize, serialize_into}; use crdt::{Crdt, ReplicatedData}; @@ -140,17 +141,17 @@ impl Tpu { }) } - fn process_thin_client_requests(_obj: SharedTpu, _socket: &UdpSocket) -> Result<()> { + fn process_thin_client_requests(_acc: &Arc, _socket: &UdpSocket) -> Result<()> { Ok(()) } fn thin_client_service( - obj: SharedTpu, + acc: Arc, exit: Arc, socket: UdpSocket, ) -> JoinHandle<()> { spawn(move || loop { - let _ = Self::process_thin_client_requests(obj.clone(), &socket); + let _ = Self::process_thin_client_requests(&acc, &socket); if exit.load(Ordering::Relaxed) { info!("sync_service exiting"); break; @@ -455,7 +456,7 @@ impl Tpu { Arc::new(Mutex::new(writer)), ); - let t_skinny = Self::thin_client_service(obj.clone(), exit.clone(), skinny); + let t_skinny = Self::thin_client_service(obj.accounting.acc.clone(), exit.clone(), skinny); let tpu = obj.clone(); let t_server = spawn(move || loop {