Skip to content

Commit 49b1561

Browse files
authored
Update locks on upgrade (paritytech#6172)
1 parent ac641cd commit 49b1561

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frame/vesting/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ use codec::{Encode, Decode};
5353
use sp_runtime::{DispatchResult, RuntimeDebug, traits::{
5454
StaticLookup, Zero, AtLeast32Bit, MaybeSerializeDeserialize, Convert
5555
}};
56-
use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure};
56+
use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure, IterableStorageMap};
5757
use frame_support::traits::{
5858
Currency, LockableCurrency, VestingSchedule, WithdrawReason, LockIdentifier,
5959
ExistenceRequirement, Get
6060
};
61-
6261
use frame_system::{self as system, ensure_signed};
6362

6463
mod benchmarking;
@@ -182,6 +181,13 @@ decl_module! {
182181

183182
fn deposit_event() = default;
184183

184+
fn on_runtime_upgrade() -> frame_support::dispatch::Weight {
185+
for (a, _) in Vesting::<T>::iter() {
186+
let _ = Self::update_lock(a);
187+
}
188+
1_000_000_000_000
189+
}
190+
185191
/// Unlock any vested funds of the sender account.
186192
///
187193
/// The dispatch origin for this call must be _Signed_ and the sender must have funds still

0 commit comments

Comments
 (0)