diff --git a/sv2/channels-sv2/src/server/extended.rs b/sv2/channels-sv2/src/server/extended.rs index 899278935b..f6562592d0 100644 --- a/sv2/channels-sv2/src/server/extended.rs +++ b/sv2/channels-sv2/src/server/extended.rs @@ -73,6 +73,7 @@ use tracing::debug; /// - the channel's current target /// - the channel's mapping between `job_id` and target /// - the channel's nominal hashrate +/// - whether the channel's nominal hashrate is treated as stable /// - the channel's [`JobStore`] /// - the channel's [`JobFactory`] /// - the channel's [`ShareAccounting`] @@ -92,6 +93,7 @@ where target: Target, job_id_to_target: HashMap, nominal_hashrate: f32, + stable_hashrate: bool, job_store: J, job_factory: JobFactory, share_accounting: ShareAccounting, @@ -240,6 +242,7 @@ where target, job_id_to_target: HashMap::new(), nominal_hashrate, + stable_hashrate: false, job_store, job_factory: JobFactory::new(version_rolling_allowed, pool_tag, miner_tag), share_accounting: ShareAccounting::new(share_batch_size), @@ -340,6 +343,16 @@ where self.nominal_hashrate } + /// Sets whether this channel's nominal hashrate should be treated as stable. + pub fn set_stable_hashrate(&mut self, stable_hashrate: bool) { + self.stable_hashrate = stable_hashrate; + } + + /// Returns whether this channel's nominal hashrate is treated as stable. + pub fn get_stable_hashrate(&self) -> bool { + self.stable_hashrate + } + /// Updates the nominal hashrate for this channel. pub fn set_nominal_hashrate(&mut self, hashrate: f32) { self.nominal_hashrate = hashrate; diff --git a/sv2/channels-sv2/src/server/standard.rs b/sv2/channels-sv2/src/server/standard.rs index 0e07f7e426..cc9c8e1156 100644 --- a/sv2/channels-sv2/src/server/standard.rs +++ b/sv2/channels-sv2/src/server/standard.rs @@ -72,6 +72,7 @@ use tracing::debug; /// - the channel's current target /// - the channel's mapping between `job_id` and target /// - the channel's nominal hashrate +/// - whether the channel's nominal hashrate is treated as stable /// - the channel's [`JobStore`] /// - the channel's share accounting state /// - the channel's expected share per minute @@ -89,6 +90,7 @@ where target: Target, job_id_to_target: HashMap, nominal_hashrate: f32, + stable_hashrate: bool, share_accounting: ShareAccounting, expected_share_per_minute: f32, job_store: J, @@ -225,6 +227,7 @@ where target, job_id_to_target: HashMap::new(), nominal_hashrate, + stable_hashrate: false, share_accounting: ShareAccounting::new(share_batch_size), expected_share_per_minute, job_factory: JobFactory::new(true, pool_tag_string, miner_tag_string), @@ -277,6 +280,16 @@ where self.nominal_hashrate = nominal_hashrate; } + /// Sets whether this channel's nominal hashrate should be treated as stable. + pub fn set_stable_hashrate(&mut self, stable_hashrate: bool) { + self.stable_hashrate = stable_hashrate; + } + + /// Returns whether this channel's nominal hashrate is treated as stable. + pub fn get_stable_hashrate(&self) -> bool { + self.stable_hashrate + } + /// Returns the requested maximum target for this channel. pub fn get_requested_max_target(&self) -> &Target { &self.requested_max_target