Skip to content

Commit

Permalink
fix(stakes): stake value only needs to be read, not written to get th…
Browse files Browse the repository at this point in the history
…e capability epoch
  • Loading branch information
drcpu-github committed Nov 21, 2024
1 parent 38d1133 commit b280c4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data_structures/src/staking/stakes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b280c4e

Please sign in to comment.