From 0e8438ee38ca97b2397fe4491b864c476b08dfe4 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 29 Aug 2023 11:47:05 +0700 Subject: [PATCH] add tolerance to nom pool try-state --- substrate/frame/nomination-pools/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index c4bebc5a1d03..e6974683e903 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -3133,7 +3133,13 @@ impl Pallet { // 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::::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 = {:?}",