Skip to content

Commit

Permalink
Update rate limit block after map insert
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Jul 11, 2024
1 parent 907b40a commit f2b0f47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pallets/subtensor/src/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ impl<T: Config> Pallet<T> {
Error::<T>::DelegateTxRateLimitExceeded
);

// Set last block for rate limiting
Self::set_last_tx_block_delegate_take(&coldkey, block);

// --- 4. Set the new take value.
Delegates::<T>::insert(hotkey.clone(), take);

// Set last block for rate limiting
Self::set_last_tx_block_delegate_take(&coldkey, block);

// --- 5. Emit the take value.
log::info!(
"TakeDecreased( coldkey:{:?}, hotkey:{:?}, take:{:?} )",
Expand Down Expand Up @@ -254,12 +254,12 @@ impl<T: Config> Pallet<T> {
Error::<T>::DelegateTxRateLimitExceeded
);

// Set last block for rate limiting
Self::set_last_tx_block_delegate_take(&coldkey, block);

// --- 6. Set the new take value.
Delegates::<T>::insert(hotkey.clone(), take);

// Set last block for rate limiting
Self::set_last_tx_block_delegate_take(&coldkey, block);

// --- 7. Emit the take value.
log::info!(
"TakeIncreased( coldkey:{:?}, hotkey:{:?}, take:{:?} )",
Expand Down

0 comments on commit f2b0f47

Please sign in to comment.