Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
remove deprecated remove_prefix to clear era_info (#13460)
Browse files Browse the repository at this point in the history
* remove deprecated remove_prefix to clear era_info

* add debug assertions to check that the returned cursor is None

* add a variable to hold the cursor

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
  • Loading branch information
surajk-m authored May 16, 2023
1 parent 1cb8fb0 commit 8423d2f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,12 @@ impl<T: Config> Pallet<T> {

/// Clear all era information for given era.
pub(crate) fn clear_era_information(era_index: EraIndex) {
#[allow(deprecated)]
<ErasStakers<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ErasStakersClipped<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ErasValidatorPrefs<T>>::remove_prefix(era_index, None);
let mut cursor = <ErasStakers<T>>::clear_prefix(era_index, u32::MAX, None);
debug_assert!(cursor.maybe_cursor.is_none());
cursor = <ErasStakersClipped<T>>::clear_prefix(era_index, u32::MAX, None);
debug_assert!(cursor.maybe_cursor.is_none());
cursor = <ErasValidatorPrefs<T>>::clear_prefix(era_index, u32::MAX, None);
debug_assert!(cursor.maybe_cursor.is_none());
<ErasValidatorReward<T>>::remove(era_index);
<ErasRewardPoints<T>>::remove(era_index);
<ErasTotalStake<T>>::remove(era_index);
Expand Down

0 comments on commit 8423d2f

Please sign in to comment.