From c702ea3abc85451f2413b03e3f40dcaecca61426 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Sun, 16 Jan 2022 02:43:35 -0500 Subject: [PATCH] chore: add test code to track missed tenures --- testnet/stacks-node/src/run_loop/neon.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testnet/stacks-node/src/run_loop/neon.rs b/testnet/stacks-node/src/run_loop/neon.rs index dc4a7bd80..6d956efaf 100644 --- a/testnet/stacks-node/src/run_loop/neon.rs +++ b/testnet/stacks-node/src/run_loop/neon.rs @@ -39,6 +39,7 @@ pub struct RunLoop { pub callbacks: RunLoopCallbacks, blocks_processed: std::sync::Arc, microblocks_processed: std::sync::Arc, + missed_tenures: std::sync::Arc, coordinator_channels: Option<(CoordinatorReceivers, CoordinatorChannels)>, } @@ -88,6 +89,7 @@ impl RunLoop { callbacks: RunLoopCallbacks::new(), blocks_processed: std::sync::Arc::new(std::sync::atomic::AtomicU64::new(0)), microblocks_processed: std::sync::Arc::new(std::sync::atomic::AtomicU64::new(0)), + missed_tenures: std::sync::Arc::new(std::sync::atomic::AtomicU64::new(0)), } } @@ -120,6 +122,14 @@ impl RunLoop { #[cfg(not(test))] fn bump_blocks_processed(&self) {} + #[cfg(test)] + pub fn get_missed_tenures_arc(&self) -> std::sync::Arc { + self.missed_tenures.clone() + } + + #[cfg(not(test))] + fn get_missed_tenures_arc(&self) {} + /// Starts the node runloop. /// /// This function will block by looping infinitely. @@ -353,6 +363,7 @@ impl RunLoop { burnchain_tip.clone(), self.get_blocks_processed_arc(), self.get_microblocks_processed_arc(), + self.get_missed_tenures_arc(), coordinator_senders.clone(), pox_watchdog.make_comms_handle(), attachments_rx, @@ -364,6 +375,7 @@ impl RunLoop { burnchain_tip.clone(), self.get_blocks_processed_arc(), self.get_microblocks_processed_arc(), + self.get_missed_tenures_arc(), coordinator_senders.clone(), pox_watchdog.make_comms_handle(), attachments_rx,