From b280c4ec2798d5cc2cedfc6e44244f2a8885c85c Mon Sep 17 00:00:00 2001 From: drcpu Date: Thu, 21 Nov 2024 11:30:55 +0000 Subject: [PATCH] fix(stakes): stake value only needs to be read, not written to get the capability epoch --- data_structures/src/staking/stakes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/src/staking/stakes.rs b/data_structures/src/staking/stakes.rs index 5fa65b108..1f850b1eb 100644 --- a/data_structures/src/staking/stakes.rs +++ b/data_structures/src/staking/stakes.rs @@ -343,7 +343,7 @@ where .get_mut(&validator) .ok_or(StakesError::ValidatorNotFound { validator })?; stakes.iter_mut().for_each(|stake| { - let old_epoch = stake.value.write().unwrap().epochs.get(capability); + let old_epoch = stake.value.read().unwrap().epochs.get(capability); let update_epoch = (current_epoch - old_epoch) / Epoch::from(reset_factor); stake .value