@@ -119,29 +119,29 @@ impl<T: Config> Pallet<T> {
119
119
Error :: <T >:: NotEnoughBalanceToStake
120
120
) ;
121
121
122
- // --- 8. Ensure the remove operation from the coldkey is a success.
123
- let actual_burn_amount =
124
- Self :: remove_balance_from_coldkey_account ( & coldkey, registration_cost) ?;
125
-
126
- // Tokens are swapped and then burned.
127
- let burned_alpha: u64 = Self :: swap_tao_for_alpha ( netuid, actual_burn_amount) ;
128
- SubnetAlphaOut :: < T > :: mutate ( netuid, |total| * total = total. saturating_sub ( burned_alpha) ) ;
129
-
130
- // --- 9. If the network account does not exist we will create it here.
131
- Self :: create_account_if_non_existent ( & coldkey, & hotkey) ;
132
-
133
- // --- 10. Ensure that the pairing is correct.
122
+ // --- 8. Ensure that the pairing is correct.
134
123
ensure ! (
135
124
Self :: coldkey_owns_hotkey( & coldkey, & hotkey) ,
136
125
Error :: <T >:: NonAssociatedColdKey
137
126
) ;
138
127
139
- // Possibly there is no neuron slots at all.
128
+ // --- 9. Possibly there are no neuron slots at all.
140
129
ensure ! (
141
130
Self :: get_max_allowed_uids( netuid) != 0 ,
142
131
Error :: <T >:: NoNeuronIdAvailable
143
132
) ;
144
133
134
+ // --- 10. Ensure the remove operation from the coldkey is a success.
135
+ let actual_burn_amount =
136
+ Self :: remove_balance_from_coldkey_account ( & coldkey, registration_cost) ?;
137
+
138
+ // Tokens are swapped and then burned.
139
+ let burned_alpha: u64 = Self :: swap_tao_for_alpha ( netuid, actual_burn_amount) ;
140
+ SubnetAlphaOut :: < T > :: mutate ( netuid, |total| * total = total. saturating_sub ( burned_alpha) ) ;
141
+
142
+ // --- 11. If the network account does not exist we will create it here.
143
+ Self :: create_account_if_non_existent ( & coldkey, & hotkey) ;
144
+
145
145
// Actually perform the registration.
146
146
let neuron_uid: u16 = Self :: register_neuron ( netuid, & hotkey) ;
147
147
0 commit comments