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
3 changes: 2 additions & 1 deletion src/translator/proxy/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ impl Bridge {
if let Some(Mining::OpenExtendedMiningChannelSuccess(success)) = message.next() {
info!("New extended channel opened with id {}", success.channel_id);
let extranonce = success.extranonce_prefix.to_vec();
let extranonce2_len = success.extranonce_size;
let extranonce2_len =
success.extranonce_size - success.extranonce_prefix.len() as u16;
self.target
.safe_lock(|t| *t = success.target.to_vec())
.map_err(|e| {
Expand Down
5 changes: 2 additions & 3 deletions src/translator/upstream/upstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,8 @@ impl Upstream {
miner_extranonce2_size,
);
let range_0 = 0..prefix_len; // upstream extranonce1
let range_1 = prefix_len..prefix_len + tproxy_e1_len; // downstream extranonce1
let range_2 = prefix_len + tproxy_e1_len
..prefix_len + m.extranonce_size as usize; // extranonce2
let range_1 = prefix_len..tproxy_e1_len; // downstream extranonce1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since you are at it remove the proxy_extranonce1_len function that looks reduntant

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

let range_2 = tproxy_e1_len..m.extranonce_size as usize; // extranonce2
let extended = match ExtendedExtranonce::from_upstream_extranonce(
extranonce_prefix.clone(), range_0.clone(), range_1.clone(), range_2.clone(),
).ok_or( Error::InvalidExtranonce(format!("Impossible to create a valid extended extranonce from {:?} {:?} {:?} {:?}",
Expand Down