@@ -21,7 +21,7 @@ fn migrate_pending_emissions_including_null_stake<T: Config>(
21
21
new_hotkey : & T :: AccountId ,
22
22
) -> Weight {
23
23
let mut weight = T :: DbWeight :: get ( ) . reads ( 0 ) ;
24
- let null_account = DefaultAccount :: < T > :: get ( ) ;
24
+ let null_account = & DefaultAccount :: < T > :: get ( ) ;
25
25
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
26
26
27
27
// Get the pending emissions for the OLD hotkey
@@ -30,18 +30,18 @@ fn migrate_pending_emissions_including_null_stake<T: Config>(
30
30
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
31
31
32
32
// Get the stake for the 0x000 key
33
- let null_stake = Stake :: < T > :: get ( & old_hotkey, & null_account) ;
33
+ let null_stake = Stake :: < T > :: get ( & old_hotkey, null_account) ;
34
34
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
35
35
// Remove
36
- Stake :: < T > :: remove ( & old_hotkey, & null_account) ;
36
+ Stake :: < T > :: remove ( & old_hotkey, null_account) ;
37
37
weight. saturating_accrue ( T :: DbWeight :: get ( ) . writes ( 1 ) ) ;
38
38
39
39
let new_total_coldkey_stake =
40
- TotalColdkeyStake :: < T > :: get ( old_hotkey ) . saturating_sub ( null_stake) ;
40
+ TotalColdkeyStake :: < T > :: get ( null_account ) . saturating_sub ( null_stake) ;
41
41
if new_total_coldkey_stake == 0 {
42
- TotalColdkeyStake :: < T > :: remove ( old_hotkey ) ;
42
+ TotalColdkeyStake :: < T > :: remove ( null_account ) ;
43
43
} else {
44
- TotalColdkeyStake :: < T > :: insert ( old_hotkey , new_total_coldkey_stake) ;
44
+ TotalColdkeyStake :: < T > :: insert ( null_account , new_total_coldkey_stake) ;
45
45
}
46
46
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 1 ) ) ;
47
47
@@ -53,8 +53,10 @@ fn migrate_pending_emissions_including_null_stake<T: Config>(
53
53
}
54
54
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 1 ) ) ;
55
55
56
+ // Remove the stake from the total stake and total issuance (since it is re-emitted)
56
57
TotalStake :: < T > :: put ( TotalStake :: < T > :: get ( ) . saturating_sub ( null_stake) ) ;
57
- weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 1 ) ) ;
58
+ TotalIssuance :: < T > :: put ( TotalIssuance :: < T > :: get ( ) . saturating_sub ( null_stake) ) ;
59
+ weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 2 , 2 ) ) ;
58
60
59
61
// Get the pending emissions for the NEW hotkey
60
62
let pending_emissions_new: u64 = PendingdHotkeyEmission :: < T > :: get ( new_hotkey) ;
0 commit comments