Skip to content

Commit 4dd50d7

Browse files
committed
move create before other ensures
1 parent 4197a03 commit 4dd50d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pallets/subtensor/src/subnets/registration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ impl<T: Config> Pallet<T> {
119119
Error::<T>::NotEnoughBalanceToStake
120120
);
121121

122+
// If the network account does not exist we will create it here.
123+
Self::create_account_if_non_existent(&coldkey, &hotkey);
124+
122125
// --- 8. Ensure that the pairing is correct.
123126
ensure!(
124127
Self::coldkey_owns_hotkey(&coldkey, &hotkey),
@@ -139,9 +142,6 @@ impl<T: Config> Pallet<T> {
139142
let burned_alpha: u64 = Self::swap_tao_for_alpha(netuid, actual_burn_amount);
140143
SubnetAlphaOut::<T>::mutate(netuid, |total| *total = total.saturating_sub(burned_alpha));
141144

142-
// --- 11. If the network account does not exist we will create it here.
143-
Self::create_account_if_non_existent(&coldkey, &hotkey);
144-
145145
// Actually perform the registration.
146146
let neuron_uid: u16 = Self::register_neuron(netuid, &hotkey);
147147

0 commit comments

Comments
 (0)