Skip to content

Commit

Permalink
Merge pull request #2338 from RolandSherwin/metrics_attoss
Browse files Browse the repository at this point in the history
metrics: cap node wallet balance to i64::MAX
  • Loading branch information
RolandSherwin authored Oct 29, 2024
2 parents 5aabab6 + 7a41d8b commit 7ca5531
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sn_node/src/put_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,13 @@ impl Node {

#[cfg(feature = "open-metrics")]
if let Some(metrics_recorder) = self.metrics_recorder() {
// FIXME: We would reach the MAX if the storecost is scaled up.
let current_value = metrics_recorder.current_reward_wallet_balance.get();
let new_value =
current_value.saturating_add(storecost.as_atto().try_into().unwrap_or(i64::MAX));
let _ = metrics_recorder
.current_reward_wallet_balance
.inc_by(storecost.as_atto().try_into().unwrap_or(i64::MAX)); // TODO maybe metrics should be in u256 too?
.set(new_value);
}
self.events_channel()
.broadcast(crate::NodeEvent::RewardReceived(storecost, address.clone()));
Expand Down

0 comments on commit 7ca5531

Please sign in to comment.