Skip to content
Snippets Groups Projects

fix(account): When a self-sufficient accounts receive money for the first time, that should trigger the random id assignment

Merged Éloïs requested to merge elois-fix-85 into release/runtime-200
1 file
+ 3
5
Compare changes
  • Side-by-side
  • Inline
  • 3d21e9af
    fix(account): bug #85 · 3d21e9af
    Éloïs authored
    When a self-sufficient accounts receive money for the first time, that should trigger the random id assignment
@@ -284,13 +284,11 @@ where
@@ -284,13 +284,11 @@ where
let result = f(&mut some_data)?;
let result = f(&mut some_data)?;
let is_providing = some_data.is_some();
let is_providing = some_data.is_some();
if !was_providing && is_providing {
if !was_providing && is_providing {
if !frame_system::Pallet::<T>::account_exists(account_id) {
if frame_system::Pallet::<T>::account_exists(account_id) {
// If the account does not exist, we should program its creation
// If the account is self-sufficient, we should increment providers directly
PendingNewAccounts::<T>::insert(account_id, ());
} else {
// If the account already exists, we should register increment providers directly
frame_system::Pallet::<T>::inc_providers(account_id);
frame_system::Pallet::<T>::inc_providers(account_id);
}
}
 
PendingNewAccounts::<T>::insert(account_id, ());
} else if was_providing && !is_providing {
} else if was_providing && !is_providing {
match frame_system::Pallet::<T>::dec_providers(account_id)? {
match frame_system::Pallet::<T>::dec_providers(account_id)? {
frame_system::DecRefStatus::Reaped => return Ok(result),
frame_system::DecRefStatus::Reaped => return Ok(result),
Loading