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
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
info!("SubmitSharesStandard on downstream channel: {} ✅", success);
messages.push((downstream.downstream_id, Mining::SubmitSharesSuccess(success)).into());
Expand Down Expand Up @@ -1022,7 +1022,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
messages.push((
downstream.downstream_id,
Expand Down Expand Up @@ -1244,7 +1244,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
info!("SubmitSharesExtended on downstream channel: {} ✅", success);
messages.push((downstream.downstream_id, Mining::SubmitSharesSuccess(success)).into());
Expand Down Expand Up @@ -1276,7 +1276,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
is_downstream_share_valid = true;
messages.push((
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,8 @@ impl HandleMiningMessagesFromServerAsync for ChannelManager {
self.channel_manager_data.super_safe_lock(|data| {
// if None, upstream is not currently available, so we skip accounting update
if let Some(upstream_channel) = data.upstream_channel.as_mut() {
upstream_channel.on_share_acknowledgement(
msg.new_submits_accepted_count,
msg.new_shares_sum as f64,
);
upstream_channel
.on_share_acknowledgement(msg.new_submits_accepted_count, msg.new_shares_sum);
}
});

Expand Down
5 changes: 3 additions & 2 deletions miner-apps/translator/src/lib/monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ServerMonitoring for ChannelManager {
let mut shares_acknowledged: u32 = 0;
let mut shares_submitted: u32 = 0;
let mut shares_rejected: u32 = 0;
let mut share_work_sum: f64 = 0.0;
let mut share_work_sum: u64 = 0;
let mut best_diff: f64 = 0.0;
let mut blocks_found: u32 = 0;

Expand All @@ -51,7 +51,8 @@ impl ServerMonitoring for ChannelManager {
.saturating_add(share_accounting.get_validated_shares());
shares_rejected =
shares_rejected.saturating_add(share_accounting.get_rejected_shares());
share_work_sum += share_accounting.get_share_work_sum();
share_work_sum =
share_work_sum.saturating_add(share_accounting.get_share_work_sum());
best_diff = best_diff.max(share_accounting.get_best_diff());
blocks_found =
blocks_found.saturating_add(share_accounting.get_blocks_found());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl HandleMiningMessagesFromServerAsync for ChannelManager {

// if None, the channel may be closed/missing, so we ignore this accounting update
if let Some(mut ch) = self.extended_channels.get_mut(&key) {
ch.on_share_acknowledgement(m.new_submits_accepted_count, m.new_shares_sum as f64);
ch.on_share_acknowledgement(m.new_submits_accepted_count, m.new_shares_sum);
}

Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
info!("SubmitSharesStandard: {} ✅", success);
messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into());
Expand Down Expand Up @@ -616,7 +616,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into());
}
Expand Down Expand Up @@ -770,7 +770,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
info!("SubmitSharesExtended: {} ✅", success);
messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into());
Expand Down Expand Up @@ -802,7 +802,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
channel_id,
last_sequence_number: share_accounting.get_last_share_sequence_number(),
new_submits_accepted_count: share_accounting.get_last_batch_accepted(),
new_shares_sum: share_accounting.get_last_batch_work_sum() as u64,
new_shares_sum: share_accounting.get_last_batch_work_sum(),
};
messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into());
}
Expand Down
8 changes: 4 additions & 4 deletions stratum-apps/src/monitoring/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct ExtendedChannelInfo {
pub last_share_sequence_number: u32,
pub best_diff: f64,
pub last_batch_accepted: u32,
pub last_batch_work_sum: f64,
pub last_batch_work_sum: u64,
pub share_batch_size: usize,
pub blocks_found: u32,
}
Expand All @@ -43,7 +43,7 @@ pub struct StandardChannelInfo {
pub last_share_sequence_number: u32,
pub best_diff: f64,
pub last_batch_accepted: u32,
pub last_batch_work_sum: f64,
pub last_batch_work_sum: u64,
pub share_batch_size: usize,
pub blocks_found: u32,
}
Expand Down Expand Up @@ -158,7 +158,7 @@ mod tests {
last_share_sequence_number: 5,
best_diff: 50.0,
last_batch_accepted: 3,
last_batch_work_sum: 30.0,
last_batch_work_sum: 30,
share_batch_size: 10,
blocks_found: 0,
}
Expand All @@ -178,7 +178,7 @@ mod tests {
last_share_sequence_number: 8,
best_diff: 80.0,
last_batch_accepted: 5,
last_batch_work_sum: 50.0,
last_batch_work_sum: 50,
share_batch_size: 20,
blocks_found: 0,
}
Expand Down
8 changes: 4 additions & 4 deletions stratum-apps/src/monitoring/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ mod tests {
last_share_sequence_number: 5,
best_diff: 50.0,
last_batch_accepted: 3,
last_batch_work_sum: 30.0,
last_batch_work_sum: 30,
share_batch_size: 10,
blocks_found: 0,
}
Expand All @@ -977,7 +977,7 @@ mod tests {
last_share_sequence_number: 8,
best_diff: 80.0,
last_batch_accepted: 5,
last_batch_work_sum: 50.0,
last_batch_work_sum: 50,
share_batch_size: 20,
blocks_found: 0,
}
Expand All @@ -998,7 +998,7 @@ mod tests {
version_rolling: true,
shares_acknowledged: 10,
shares_rejected: 0,
share_work_sum: 100.0,
share_work_sum: 100,
shares_submitted: 12,
best_diff: 50.0,
blocks_found: 0,
Expand All @@ -1018,7 +1018,7 @@ mod tests {
shares_acknowledged: 20,
shares_submitted: 22,
shares_rejected: 1,
share_work_sum: 200.0,
share_work_sum: 200,
best_diff: 80.0,
blocks_found: 0,
}
Expand Down
8 changes: 4 additions & 4 deletions stratum-apps/src/monitoring/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct ServerExtendedChannelInfo {
pub shares_acknowledged: u32,
pub shares_submitted: u32,
pub shares_rejected: u32,
pub share_work_sum: f64,
pub share_work_sum: u64,
pub best_diff: f64,
pub blocks_found: u32,
}
Expand All @@ -38,7 +38,7 @@ pub struct ServerStandardChannelInfo {
pub shares_acknowledged: u32,
pub shares_submitted: u32,
pub shares_rejected: u32,
pub share_work_sum: f64,
pub share_work_sum: u64,
pub best_diff: f64,
pub blocks_found: u32,
}
Expand Down Expand Up @@ -118,7 +118,7 @@ mod tests {
version_rolling: true,
shares_acknowledged: 10,
shares_rejected: 0,
share_work_sum: 100.0,
share_work_sum: 100,
shares_submitted: 12,
best_diff: 50.0,
blocks_found: 0,
Expand All @@ -138,7 +138,7 @@ mod tests {
shares_acknowledged: 20,
shares_submitted: 22,
shares_rejected: 1,
share_work_sum: 200.0,
share_work_sum: 200,
best_diff: 80.0,
blocks_found: 0,
}
Expand Down
Loading