Skip to content

Commit

Permalink
skip accounts without locked
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci committed Sep 4, 2024
1 parent 270c5da commit f594d61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pallets/dapp-staking/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,15 @@ impl<T: Config, W: WeightInfo> SteppedMigration for LazyMigration<T, W> {

// 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);
}
Expand Down

0 comments on commit f594d61

Please sign in to comment.