From d65b2164258d46e9e016eff6fde1dcd8cffb888a Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sun, 26 Jan 2025 19:25:13 -0500 Subject: [PATCH] dont register owner twice --- pallets/subtensor/src/migrations/migrate_rao.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/migrations/migrate_rao.rs b/pallets/subtensor/src/migrations/migrate_rao.rs index 2b325aadcf..13ff02c118 100644 --- a/pallets/subtensor/src/migrations/migrate_rao.rs +++ b/pallets/subtensor/src/migrations/migrate_rao.rs @@ -98,8 +98,12 @@ pub fn migrate_rao() -> Weight { SubnetOwnerHotkey::::insert(netuid, owner_coldkey.clone()); // Associate the coldkey to coldkey. Pallet::::create_account_if_non_existent(&owner_coldkey, &owner_coldkey); - // Register the owner_coldkey as neuron to the network. - let _neuron_uid: u16 = Pallet::::register_neuron(*netuid, &owner_coldkey); + + // Only register the owner coldkey if it's not already a hotkey on the subnet. + if !Uids::::contains_key(*netuid, &owner_coldkey) { + // Register the owner_coldkey as neuron to the network. + let _neuron_uid: u16 = Pallet::::register_neuron(*netuid, &owner_coldkey); + } // Register the neuron immediately. if !Identities::::contains_key(owner_coldkey.clone()) { // Set the identitiy for the Owner coldkey if non existent.