Skip to content

Commit

Permalink
feat(subnet_emission): check if registered, if not, add balance to ac…
Browse files Browse the repository at this point in the history
…count
  • Loading branch information
aripiprazole committed Nov 12, 2024
1 parent 37741c2 commit e310784
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pallets/subnet_emission/src/subnet_consensus/util/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::params::{AccountKey, ConsensusParams, FlattenedModules, ModuleKey};
use crate::EmissionError;
use frame_support::{ensure, DebugNoBound};
use frame_support::{ensure, DebugNoBound, StorageMap};

Check failure on line 3 in pallets/subnet_emission/src/subnet_consensus/util/consensus.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `StorageMap`
use pallet_subspace::{math::*, vec, BalanceOf, Pallet as PalletSubspace};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
Expand Down Expand Up @@ -796,13 +796,13 @@ impl<T: Config> ConsensusOutput<T> {
self.founder_emission,
);

// TODO: Check if all of the keys, that you are increasing the stake for, are actually
// registered on the `subnet_id`, if they are not registerd on the subnet (because they got
// deregistered in the parameter collection period), you do not increase stake, but you
// increase their balance using the funciton `add_balance_to_account`
for (module_key, emitted_to) in self.emission_map {
for (account_key, emission) in emitted_to {
PalletSubspace::<T>::increase_stake(&account_key.0, &module_key.0, emission);
if PalletSubspace::<T>::is_registered(Some(subnet_id), &account_key.0) {
PalletSubspace::<T>::increase_stake(&account_key.0, &module_key.0, emission);
} else {
PalletSubspace::<T>::add_balance_to_account(&account_key.0, emission);
}
}
}
}
Expand Down

0 comments on commit e310784

Please sign in to comment.