diff --git a/pallets/subtensor/src/swap.rs b/pallets/subtensor/src/swap.rs index 692640d34..4f8097d26 100644 --- a/pallets/subtensor/src/swap.rs +++ b/pallets/subtensor/src/swap.rs @@ -192,12 +192,12 @@ impl Pallet { let mut writes = 0; let stakes: Vec<(T::AccountId, u64)> = Stake::::iter_prefix(old_hotkey).collect(); let stake_count = stakes.len() as u32; - + for (coldkey, stake_amount) in stakes { Stake::::insert(new_hotkey, &coldkey, stake_amount); writes += 1; // One write for insert } - + // Clear the prefix for the old hotkey after transferring all stakes let _ = Stake::::clear_prefix(old_hotkey, stake_count, None); writes += 1; // One write for clear_prefix