Skip to content

Commit 17308f5

Browse files
committed
disable TAO into subnet if reg are disabled
1 parent 4cf3a68 commit 17308f5

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,26 @@ impl<T: Config> Pallet<T> {
122122
netuid,
123123
subnet_proportion
124124
);
125-
// 3.7: Calculate subnet's TAO emission: E_s = P_s * E_m
126-
let tao_in: u64 = mech_emission
127-
.checked_mul(subnet_proportion)
128-
.unwrap_or(I96F32::saturating_from_num(0))
129-
.saturating_to_num::<u64>();
130-
log::debug!(
131-
"Subnet TAO emission (E_s) for netuid {:?}: {:?}",
132-
netuid,
133-
tao_in
134-
);
135-
// 3.8: Store the subnet TAO emission.
136-
*tao_in_map.entry(*netuid).or_insert(0) = tao_in;
137-
// 3.9: Store the block emission for this subnet for chain storage.
138-
EmissionValues::<T>::insert(*netuid, tao_in);
125+
126+
// Only emit TAO if the subnetwork allows registration.
127+
if Self::get_network_registration_allowed(*netuid)
128+
|| Self::get_network_pow_registration_allowed(*netuid)
129+
{
130+
// 3.7: Calculate subnet's TAO emission: E_s = P_s * E_m
131+
let tao_in: u64 = mech_emission
132+
.checked_mul(subnet_proportion)
133+
.unwrap_or(I96F32::saturating_from_num(0))
134+
.saturating_to_num::<u64>();
135+
log::debug!(
136+
"Subnet TAO emission (E_s) for netuid {:?}: {:?}",
137+
netuid,
138+
tao_in
139+
);
140+
// 3.8: Store the subnet TAO emission.
141+
*tao_in_map.entry(*netuid).or_insert(0) = tao_in;
142+
// 3.9: Store the block emission for this subnet for chain storage.
143+
EmissionValues::<T>::insert(*netuid, tao_in);
144+
}
139145
}
140146

141147
// == We'll save the owner cuts for each subnet.

0 commit comments

Comments
 (0)