Skip to content

Commit 163667a

Browse files
committed
only update tx rate limit *after* ensure
1 parent fe40cb9 commit 163667a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pallets/subtensor/src/staking/set_children.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ impl<T: Config> Pallet<T> {
5959
Error::<T>::TxRateLimitExceeded
6060
);
6161

62-
// Set last transaction block
63-
let current_block = Self::get_current_block_as_u64();
64-
Self::set_last_transaction_block_on_subnet(
65-
&hotkey,
66-
netuid,
67-
&TransactionType::SetChildren,
68-
current_block,
69-
);
70-
7162
// Check that this delegation is not on the root network. Child hotkeys are not valid on root.
7263
ensure!(
7364
netuid != Self::get_root_netuid(),
@@ -119,6 +110,15 @@ impl<T: Config> Pallet<T> {
119110
Error::<T>::NotEnoughStakeToSetChildkeys
120111
);
121112

113+
// Set last transaction block
114+
let current_block = Self::get_current_block_as_u64();
115+
Self::set_last_transaction_block_on_subnet(
116+
&hotkey,
117+
netuid,
118+
&TransactionType::SetChildren,
119+
current_block,
120+
);
121+
122122
// Calculate cool-down block
123123
let cooldown_block =
124124
Self::get_current_block_as_u64().saturating_add(DefaultPendingCooldown::<T>::get());

0 commit comments

Comments
 (0)