Skip to content
Draft
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
2 changes: 1 addition & 1 deletion bitcoin-core-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ async-channel = "1.5.1"
# fetching from github enables synchronizing development workflows across sv2-apps and stratum repos
# it MUST be changed before bitcoin-core-sv2 is published to crates.io
# with the proper version of stratum-core being fetched from crates.io as well
stratum-core = { git = "https://github.com/stratum-mining/stratum", branch = "main" }
stratum-core = { git = "https://github.com/plebhash/stratum", rev = "9edcc5f87b1a84af4acac8a48ca8d097c0bd0e10" }

bitcoin-capnp-types = "0.2.0"
34 changes: 17 additions & 17 deletions integration-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions miner-apps/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions miner-apps/jd-client/src/lib/channel_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1184,9 +1184,12 @@ impl ChannelManager {
};

let Some(new_hashrate) = new_hashrate_opt else {
channel_state.set_stable_hashrate(true);
return;
};

channel_state.set_stable_hashrate(false);

match channel_state.update_channel(new_hashrate, None) {
Ok(()) => {
let updated_target = channel_state.get_target();
Expand Down Expand Up @@ -1227,6 +1230,7 @@ impl ChannelManager {
};

if let Some(new_hashrate) = new_hashrate_opt {
channel.set_stable_hashrate(false);
match channel.update_channel(new_hashrate, None) {
Ok(()) => {
let updated_target = channel.get_target();
Expand All @@ -1246,6 +1250,8 @@ impl ChannelManager {
"Failed to update standard channel channel_id={channel_id} during vardiff {e:?}"
),
}
} else {
channel.set_stable_hashrate(true);
}
}

Expand Down
2 changes: 2 additions & 0 deletions miner-apps/jd-client/src/lib/monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ fn downstream_to_sv2_client_info(client: &Downstream) -> Option<Sv2ClientInfo> {
channel_id,
user_identity: user_identity.clone(),
nominal_hashrate: extended_channel.get_nominal_hashrate(),
stable_hashrate: extended_channel.get_stable_hashrate(),
target_hex: hex::encode(target.to_be_bytes()),
requested_max_target_hex: hex::encode(requested_max_target.to_be_bytes()),
extranonce_prefix_hex: hex::encode(extended_channel.get_extranonce_prefix()),
Expand Down Expand Up @@ -108,6 +109,7 @@ fn downstream_to_sv2_client_info(client: &Downstream) -> Option<Sv2ClientInfo> {
channel_id,
user_identity: user_identity.clone(),
nominal_hashrate: standard_channel.get_nominal_hashrate(),
stable_hashrate: standard_channel.get_stable_hashrate(),
target_hex: hex::encode(target.to_be_bytes()),
requested_max_target_hex: hex::encode(requested_max_target.to_be_bytes()),
extranonce_prefix_hex: hex::encode(standard_channel.get_extranonce_prefix()),
Expand Down
11 changes: 11 additions & 0 deletions miner-apps/translator/src/lib/sv1/downstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct DownstreamData {
pub cached_notify: Option<json_rpc::Message>,
pub pending_target: Option<Target>,
pub pending_hashrate: Option<Hashrate>,
pub stable_hashrate: bool,
// Queue of Sv1 handshake messages received while waiting for SV2 channel to open
pub queued_sv1_handshake_messages: Vec<json_rpc::Message>,
// Stores pending shares to be sent to the sv1_server
Expand Down Expand Up @@ -106,6 +107,7 @@ impl DownstreamData {
cached_notify: None,
pending_target: None,
pending_hashrate: None,
stable_hashrate: false,
queued_sv1_handshake_messages: Vec::new(),
pending_share: None,
upstream_target: None,
Expand All @@ -127,6 +129,15 @@ impl DownstreamData {
debug!("Downstream {downstream_id}: Set pending hashrate");
}

pub fn set_stable_hashrate(&mut self, stable_hashrate: bool, downstream_id: DownstreamId) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to pass downstream_id just for the debug log?

self.stable_hashrate = stable_hashrate;
debug!("Downstream {downstream_id}: Set stable hashrate to {stable_hashrate}");
}

pub fn get_stable_hashrate(&self) -> bool {
self.stable_hashrate
}

pub fn set_upstream_target(&mut self, upstream_target: Target, downstream_id: DownstreamId) {
self.upstream_target = Some(upstream_target);
debug!(
Expand Down
Loading
Loading