From 2c684e4ddfe2c901e6639f8969c6ae83ea0fa6ac Mon Sep 17 00:00:00 2001 From: Suraj Kumar Date: Tue, 16 May 2023 22:09:21 +0530 Subject: [PATCH] remove deprecated remove_prefix to clear era_info (#13460) * 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 <> --- substrate/frame/staking/src/pallet/impls.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/frame/staking/src/pallet/impls.rs b/substrate/frame/staking/src/pallet/impls.rs index 1d98385728..82a0956da7 100644 --- a/substrate/frame/staking/src/pallet/impls.rs +++ b/substrate/frame/staking/src/pallet/impls.rs @@ -669,12 +669,12 @@ impl Pallet { /// Clear all era information for given era. pub(crate) fn clear_era_information(era_index: EraIndex) { - #[allow(deprecated)] - >::remove_prefix(era_index, None); - #[allow(deprecated)] - >::remove_prefix(era_index, None); - #[allow(deprecated)] - >::remove_prefix(era_index, None); + let mut cursor = >::clear_prefix(era_index, u32::MAX, None); + debug_assert!(cursor.maybe_cursor.is_none()); + cursor = >::clear_prefix(era_index, u32::MAX, None); + debug_assert!(cursor.maybe_cursor.is_none()); + cursor = >::clear_prefix(era_index, u32::MAX, None); + debug_assert!(cursor.maybe_cursor.is_none()); >::remove(era_index); >::remove(era_index); >::remove(era_index);