Skip to content

Commit

Permalink
add tolerance to nom pool try-state
Browse files Browse the repository at this point in the history
  • Loading branch information
liamaharon committed Aug 29, 2023
1 parent 70ab64b commit 0e8438e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion substrate/frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3133,7 +3133,13 @@ impl<T: Config> Pallet<T> {
// the sum of the pending rewards must be less than the leftover balance. Since the
// reward math rounds down, we might accumulate some dust here.
let pending_rewards_lt_leftover_bal = RewardPool::<T>::current_balance(id) >=
pools_members_pending_rewards.get(&id).copied().unwrap_or_default();
pools_members_pending_rewards
.get(&id)
.copied()
.unwrap_or_default()
// allow for some tiny tolerance here to account for existential deposit
// increases which may only be handled lazily.
.saturating_sub(T::Currency::minimum_balance());
if !pending_rewards_lt_leftover_bal {
log::warn!(
"pool {:?}, sum pending rewards = {:?}, remaining balance = {:?}",
Expand Down

0 comments on commit 0e8438e

Please sign in to comment.