Skip to content

Commit d65b216

Browse files
committed
dont register owner twice
1 parent a4c49e3 commit d65b216

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pallets/subtensor/src/migrations/migrate_rao.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ pub fn migrate_rao<T: Config>() -> Weight {
9898
SubnetOwnerHotkey::<T>::insert(netuid, owner_coldkey.clone());
9999
// Associate the coldkey to coldkey.
100100
Pallet::<T>::create_account_if_non_existent(&owner_coldkey, &owner_coldkey);
101-
// Register the owner_coldkey as neuron to the network.
102-
let _neuron_uid: u16 = Pallet::<T>::register_neuron(*netuid, &owner_coldkey);
101+
102+
// Only register the owner coldkey if it's not already a hotkey on the subnet.
103+
if !Uids::<T>::contains_key(*netuid, &owner_coldkey) {
104+
// Register the owner_coldkey as neuron to the network.
105+
let _neuron_uid: u16 = Pallet::<T>::register_neuron(*netuid, &owner_coldkey);
106+
}
103107
// Register the neuron immediately.
104108
if !Identities::<T>::contains_key(owner_coldkey.clone()) {
105109
// Set the identitiy for the Owner coldkey if non existent.

0 commit comments

Comments
 (0)