Skip to content

Commit 11f3db6

Browse files
committed
commit Cargo.lock
1 parent 52378dc commit 11f3db6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ impl<T: Config> Pallet<T> {
124124
let mut alpha_in: BTreeMap<NetUid, U96F32> = BTreeMap::new();
125125
let mut alpha_out: BTreeMap<NetUid, U96F32> = BTreeMap::new();
126126
let mut excess_tao: BTreeMap<NetUid, U96F32> = BTreeMap::new();
127+
let tao_block_emission: U96F32 = U96F32::saturating_from_num(
128+
Self::get_block_emission()
129+
.unwrap_or(TaoCurrency::ZERO)
130+
.to_u64(),
131+
);
127132

128133
// Only calculate for subnets that we are emitting to.
129134
for (&netuid_i, &tao_emission_i) in subnet_emissions.iter() {
@@ -142,8 +147,9 @@ impl<T: Config> Pallet<T> {
142147
let alpha_out_i: U96F32 = alpha_emission_i;
143148
let mut alpha_in_i: U96F32 = tao_emission_i.safe_div_or(price_i, U96F32::from_num(0.0));
144149

145-
if alpha_in_i > alpha_emission_i {
146-
alpha_in_i = alpha_emission_i;
150+
let alpha_injection_cap: U96F32 = alpha_emission_i.min(tao_block_emission);
151+
if alpha_in_i > alpha_injection_cap {
152+
alpha_in_i = alpha_injection_cap;
147153
tao_in_i = alpha_in_i.saturating_mul(price_i);
148154
}
149155

0 commit comments

Comments
 (0)