From 2e4323b2079cf06cc16445956d0edeaf010be1c1 Mon Sep 17 00:00:00 2001 From: Eric Price Date: Fri, 6 Feb 2026 17:47:16 -0500 Subject: [PATCH] feat(channels): add set_nominal_hashrate to client ExtendedChannel Add a setter for nominal_hashrate on the client-side ExtendedChannel. This allows downstream consumers (e.g. tProxy) to update the locally tracked hashrate when the downstream vardiff produces an UpdateChannel message, keeping it consistent with actual miner performance. See: stratum-mining/sv2-apps#242 --- sv2/channels-sv2/src/client/extended.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sv2/channels-sv2/src/client/extended.rs b/sv2/channels-sv2/src/client/extended.rs index 308e83f1c5..a622b316bb 100644 --- a/sv2/channels-sv2/src/client/extended.rs +++ b/sv2/channels-sv2/src/client/extended.rs @@ -182,6 +182,11 @@ impl<'a> ExtendedChannel<'a> { self.nominal_hashrate } + /// Sets the nominal hashrate for the channel, in h/s. + pub fn set_nominal_hashrate(&mut self, hashrate: f32) { + self.nominal_hashrate = hashrate; + } + /// Returns a reference to the currently active job, if any. pub fn get_active_job(&self) -> Option<&ExtendedJob<'a>> { self.active_job.as_ref()