Skip to content

Commit

Permalink
Force incrementing of consumers (paritytech#13878)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork authored and nathanwhit committed Jul 19, 2023
1 parent b1b86cc commit 53c91b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ pub mod pallet {
}
a.flags.set_new_logic();
if !a.reserved.is_zero() || !a.frozen.is_zero() {
if !system::Pallet::<T>::can_inc_consumer(who) {
// Gah!! We have a non-zero reserve balance but no provider refs :(
if system::Pallet::<T>::providers(who) == 0 {
// Gah!! We have no provider refs :(
// This shouldn't practically happen, but we need a failsafe anyway: let's give
// them enough for an ED.
log::warn!(
Expand All @@ -794,7 +794,7 @@ pub mod pallet {
a.free = a.free.max(Self::ed());
system::Pallet::<T>::inc_providers(who);
}
let _ = system::Pallet::<T>::inc_consumers(who).defensive();
let _ = system::Pallet::<T>::inc_consumers_without_limit(who).defensive();
}
// Should never fail - we're only setting a bit.
let _ = T::AccountStore::try_mutate_exists(who, |account| -> DispatchResult {
Expand Down

0 comments on commit 53c91b6

Please sign in to comment.