Skip to content

Commit cb35762

Browse files
Merge pull request #733 from opentensor/fix/childkey-rate-limits
Fix rate limit for setting children
2 parents 8f9e841 + d6790a3 commit cb35762

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pallets/subtensor/src/staking/set_children.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,23 @@ impl<T: Config> Pallet<T> {
6060

6161
// Ensure the hotkey passes the rate limit.
6262
ensure!(
63-
Self::passes_rate_limit_globally(
63+
Self::passes_rate_limit_on_subnet(
6464
&TransactionType::SetChildren, // Set children.
6565
&hotkey, // Specific to a hotkey.
66+
netuid, // Specific to a subnet.
6667
),
6768
Error::<T>::TxRateLimitExceeded
6869
);
6970

71+
// Set last transaction block
72+
let current_block = Self::get_current_block_as_u64();
73+
Self::set_last_transaction_block(
74+
&hotkey,
75+
netuid,
76+
&TransactionType::SetChildren,
77+
current_block
78+
);
79+
7080
// --- 2. Check that this delegation is not on the root network. Child hotkeys are not valid on root.
7181
ensure!(
7282
netuid != Self::get_root_netuid(),

0 commit comments

Comments
 (0)