From f2b0f47c0a88f3c85210cf14ccd510e1c522e913 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Thu, 11 Jul 2024 17:51:31 -0400 Subject: [PATCH] Update rate limit block after map insert --- pallets/subtensor/src/staking.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pallets/subtensor/src/staking.rs b/pallets/subtensor/src/staking.rs index 8db8c943a..6d7eeefd4 100644 --- a/pallets/subtensor/src/staking.rs +++ b/pallets/subtensor/src/staking.rs @@ -165,12 +165,12 @@ impl Pallet { Error::::DelegateTxRateLimitExceeded ); - // Set last block for rate limiting - Self::set_last_tx_block_delegate_take(&coldkey, block); - // --- 4. Set the new take value. Delegates::::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:{:?} )", @@ -254,12 +254,12 @@ impl Pallet { Error::::DelegateTxRateLimitExceeded ); - // Set last block for rate limiting - Self::set_last_tx_block_delegate_take(&coldkey, block); - // --- 6. Set the new take value. Delegates::::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:{:?} )",