Skip to content
2 changes: 2 additions & 0 deletions pallets/subtensor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,8 @@ pub mod pallet {
total_stake >= Self::get_stake_threshold()
}



/// Helper function to check if register is allowed
pub fn checked_allowed_register(netuid: NetUid) -> bool {
if netuid.is_root() {
Expand Down
4 changes: 4 additions & 0 deletions pallets/subtensor/src/staking/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ impl<T: Config> Pallet<T> {
SubnetAlphaOut::<T>::mutate(netuid, |total| {
*total = total.saturating_sub(amount);
});
// Keep TotalStake in sync
TotalStake::<T>::mutate(|total| {
*total = total.saturating_sub(amount.to_u64().into());
});
}

/// The function clears Alpha map in batches. Each run will check ALPHA_MAP_BATCH_SIZE
Expand Down