Skip to content
Snippets Groups Projects
Commit 3d21e9af authored by Éloïs's avatar Éloïs
Browse files

fix(account): bug #85

When a self-sufficient accounts receive money for the first time, that should trigger the random id assignment
parent ebcc1423
No related branches found
No related tags found
1 merge request!90fix(account): 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),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment