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