mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
emit warn log on bad state (#14513)
This commit is contained in:
@@ -3135,16 +3135,18 @@ impl<T: Config> Pallet<T> {
|
||||
RewardPools::<T>::iter_keys().try_for_each(|id| -> Result<(), TryRuntimeError> {
|
||||
// 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.
|
||||
log!(
|
||||
trace,
|
||||
"pool {:?}, sum pending rewards = {:?}, remaining balance = {:?}",
|
||||
id,
|
||||
pools_members_pending_rewards.get(&id),
|
||||
RewardPool::<T>::current_balance(id)
|
||||
);
|
||||
let pending_rewards_lt_leftover_bal = RewardPool::<T>::current_balance(id) >=
|
||||
pools_members_pending_rewards.get(&id).copied().unwrap_or_default();
|
||||
if !pending_rewards_lt_leftover_bal {
|
||||
log::warn!(
|
||||
"pool {:?}, sum pending rewards = {:?}, remaining balance = {:?}",
|
||||
id,
|
||||
pools_members_pending_rewards.get(&id),
|
||||
RewardPool::<T>::current_balance(id)
|
||||
);
|
||||
}
|
||||
ensure!(
|
||||
RewardPool::<T>::current_balance(id) >=
|
||||
pools_members_pending_rewards.get(&id).copied().unwrap_or_default(),
|
||||
pending_rewards_lt_leftover_bal,
|
||||
"The sum of the pending rewards must be less than the leftover balance."
|
||||
);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user