From f594d619ab30dae8de4b43532a8f3543bfc50e5f Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Wed, 4 Sep 2024 11:49:53 +0200 Subject: [PATCH] skip accounts without locked --- pallets/dapp-staking/src/migration.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pallets/dapp-staking/src/migration.rs b/pallets/dapp-staking/src/migration.rs index 2f0511ac8a..43c1999d36 100644 --- a/pallets/dapp-staking/src/migration.rs +++ b/pallets/dapp-staking/src/migration.rs @@ -471,7 +471,15 @@ impl SteppedMigration for LazyMigration { // If there's a next item in the iterator, perform the migration. if let Some((ref last_key, mut ledger)) = iter.next() { + if ledger.unlocking.is_empty() { + // no unlocking for this account, nothing to update + cursor = Some(last_key.clone()); // Return the processed key as the new cursor. + continue; + } for chunk in ledger.unlocking.iter_mut() { + if current_block_number >= chunk.unlock_block { + continue; // chunk already unlocked + } let remaining_blocks = chunk.unlock_block.saturating_sub(current_block_number); chunk.unlock_block.saturating_accrue(remaining_blocks); }