@@ -190,24 +190,33 @@ impl<T: Config> Pallet<T> {
190
190
191
191
// 5. Swap LastTxBlock
192
192
// LastTxBlock( hotkey ) --> u64 -- the last transaction block for the hotkey.
193
+ let last_tx_block: u64 = LastTxBlock :: < T > :: get ( old_hotkey) ;
193
194
LastTxBlock :: < T > :: remove ( old_hotkey) ;
194
- LastTxBlock :: < T > :: insert ( new_hotkey, Self :: get_current_block_as_u64 ( ) ) ;
195
- weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 0 , 2 ) ) ;
195
+ LastTxBlock :: < T > :: insert ( new_hotkey, last_tx_block ) ;
196
+ weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 2 ) ) ;
196
197
197
198
// 6. Swap LastTxBlockDelegateTake
198
199
// LastTxBlockDelegateTake( hotkey ) --> u64 -- the last transaction block for the hotkey delegate take.
200
+ let last_tx_block_delegate_take: u64 = LastTxBlockDelegateTake :: < T > :: get ( old_hotkey) ;
199
201
LastTxBlockDelegateTake :: < T > :: remove ( old_hotkey) ;
200
- LastTxBlockDelegateTake :: < T > :: insert ( new_hotkey, Self :: get_current_block_as_u64 ( ) ) ;
202
+ LastTxBlockDelegateTake :: < T > :: insert ( new_hotkey, last_tx_block_delegate_take) ;
203
+ weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 2 ) ) ;
204
+
205
+ // 7. Swap LastTxBlockChildKeyTake
206
+ // LastTxBlockChildKeyTake( hotkey ) --> u64 -- the last transaction block for the hotkey child key take.
207
+ let last_tx_block_child_key_take: u64 = LastTxBlockChildKeyTake :: < T > :: get ( old_hotkey) ;
208
+ LastTxBlockChildKeyTake :: < T > :: remove ( old_hotkey) ;
209
+ LastTxBlockChildKeyTake :: < T > :: insert ( new_hotkey, last_tx_block_child_key_take) ;
201
210
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 2 ) ) ;
202
211
203
- // 7 . Swap Senate members.
212
+ // 8 . Swap Senate members.
204
213
// Senate( hotkey ) --> ?
205
214
if T :: SenateMembers :: is_member ( old_hotkey) {
206
215
T :: SenateMembers :: swap_member ( old_hotkey, new_hotkey) . map_err ( |e| e. error ) ?;
207
216
weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 2 ) ) ;
208
217
}
209
218
210
- // 8 . Swap delegates.
219
+ // 9 . Swap delegates.
211
220
// Delegates( hotkey ) -> take value -- the hotkey delegate take value.
212
221
if Delegates :: < T > :: contains_key ( old_hotkey) {
213
222
let old_delegate_take = Delegates :: < T > :: get ( old_hotkey) ;
0 commit comments