@@ -43,29 +43,11 @@ impl<T: Config> Pallet<T> {
43
43
// 1. Get the old hotkey under this position.
44
44
let old_hotkey: T :: AccountId = Keys :: < T > :: get ( netuid, uid_to_replace) ;
45
45
46
- // Do not deregister the owner's top-stake hotkey
47
- let mut top_stake_sn_owner_hotkey: Option < T :: AccountId > = None ;
48
- let mut max_stake_weight: I64F64 = I64F64 :: from_num ( -1 ) ;
49
- for neuron_uid in 0 ..Self :: get_subnetwork_n ( netuid) {
50
- if let Ok ( hotkey) = Self :: get_hotkey_for_net_and_uid ( netuid, neuron_uid) {
51
- let coldkey = Self :: get_owning_coldkey_for_hotkey ( & hotkey) ;
52
- if Self :: get_subnet_owner ( netuid) != coldkey {
53
- continue ;
54
- }
55
-
56
- let stake_weights = Self :: get_stake_weights_for_hotkey_on_subnet ( & hotkey, netuid) ;
57
- if stake_weights. 0 > max_stake_weight {
58
- max_stake_weight = stake_weights. 0 ;
59
- top_stake_sn_owner_hotkey = Some ( hotkey) ;
60
- }
61
- }
62
- }
63
-
64
- if let Some ( ref sn_owner_hotkey) = top_stake_sn_owner_hotkey {
65
- if sn_owner_hotkey == & old_hotkey {
46
+ // Do not replace owner hotkey from `SubnetOwnerHotkey`
47
+ if let Ok ( sn_owner_hotkey) = SubnetOwnerHotkey :: < T > :: try_get ( netuid) {
48
+ if sn_owner_hotkey == old_hotkey. clone ( ) {
66
49
log:: warn!(
67
- "replace_neuron: Skipped replacement because neuron belongs to the subnet owner. \
68
- And this hotkey has the highest stake weight of all the owner's hotkeys. \
50
+ "replace_neuron: Skipped replacement because neuron is the subnet owner hotkey. \
69
51
netuid: {:?}, uid_to_replace: {:?}, new_hotkey: {:?}, owner_hotkey: {:?}",
70
52
netuid,
71
53
uid_to_replace,
0 commit comments