Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions sv2/channels-sv2/src/server/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand All @@ -92,6 +93,7 @@ where
target: Target,
job_id_to_target: HashMap<u32, Target>,
nominal_hashrate: f32,
stable_hashrate: bool,
job_store: J,
job_factory: JobFactory,
share_accounting: ShareAccounting,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions sv2/channels-sv2/src/server/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,6 +90,7 @@ where
target: Target,
job_id_to_target: HashMap<u32, Target>,
nominal_hashrate: f32,
stable_hashrate: bool,
share_accounting: ShareAccounting,
expected_share_per_minute: f32,
job_store: J,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
Loading