From 6a238a76228c16c3a15e91a6d1352175299b5862 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Fri, 31 Jan 2025 18:09:48 +0000 Subject: [PATCH] added set_miner_current_rejections_timeout and set_miner_current_rejections to Counters struct --- .../src/nakamoto_node/signer_coordinator.rs | 7 ++----- testnet/stacks-node/src/run_loop/neon.rs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs b/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs index 7a778580d7..97b22ef68e 100644 --- a/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs +++ b/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs @@ -406,11 +406,8 @@ impl SignerCoordinator { "rejections_step" => rejections_step, "rejections_threshold" => self.total_weight.saturating_sub(self.weight_threshold)); - Counters::set( - &counters.naka_miner_current_rejections_timeout_secs, - rejections_timeout.as_secs(), - ); - Counters::set(&counters.naka_miner_current_rejections, rejections); + counters.set_miner_current_rejections_timeout(rejections_timeout.as_secs()); + counters.set_miner_current_rejections(rejections); } if block_status diff --git a/testnet/stacks-node/src/run_loop/neon.rs b/testnet/stacks-node/src/run_loop/neon.rs index 1d372f1051..3ef3e45ccb 100644 --- a/testnet/stacks-node/src/run_loop/neon.rs +++ b/testnet/stacks-node/src/run_loop/neon.rs @@ -139,12 +139,12 @@ impl Counters { fn inc(_ctr: &RunLoopCounter) {} #[cfg(test)] - pub fn set(ctr: &RunLoopCounter, value: u64) { + fn set(ctr: &RunLoopCounter, value: u64) { ctr.0.store(value, Ordering::SeqCst); } #[cfg(not(test))] - pub fn set(_ctr: &RunLoopCounter, _value: u64) {} + fn set(_ctr: &RunLoopCounter, _value: u64) {} pub fn bump_blocks_processed(&self) { Counters::inc(&self.blocks_processed); @@ -217,6 +217,14 @@ impl Counters { pub fn set_microblocks_processed(&self, value: u64) { Counters::set(&self.microblocks_processed, value) } + + pub fn set_miner_current_rejections_timeout(&self, value: u64) { + Counters::set(&self.naka_miner_current_rejections_timeout_secs, value) + } + + pub fn set_miner_current_rejections(&self, value: u64) { + Counters::set(&self.naka_miner_current_rejections, value) + } } /// Coordinating a node running in neon mode.