Fix underflow in rewards estimation

This commit is contained in:
durch
2022-06-06 14:17:59 +02:00
parent d3fe80c875
commit 1bdaab6c97
@@ -458,7 +458,7 @@ impl MixNodeBond {
.unwrap_or_default();
let operator_reward = self.operator_reward(params);
// Total reward has to be the sum of operator and delegator rewards
let delegators_reward = node_profit - operator_reward;
let delegators_reward = node_profit.saturating_sub(operator_reward);
Ok(RewardEstimate {
total_node_reward: total_node_reward.try_into()?,