diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index ce0781b536..a2ba7da005 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -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() { diff --git a/pallets/subtensor/src/staking/helpers.rs b/pallets/subtensor/src/staking/helpers.rs index 1176064e36..fc57ad2641 100644 --- a/pallets/subtensor/src/staking/helpers.rs +++ b/pallets/subtensor/src/staking/helpers.rs @@ -324,6 +324,10 @@ impl Pallet { SubnetAlphaOut::::mutate(netuid, |total| { *total = total.saturating_sub(amount); }); + // Keep TotalStake in sync + TotalStake::::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