Skip to content

Commit

Permalink
Merge pull request #1921 from subspace/tx-range-migration
Browse files Browse the repository at this point in the history
Migrate domain tx range on runtime upgrade
  • Loading branch information
NingLin-P authored Sep 4, 2023
2 parents af445bf + 31fadec commit 4a685ef
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/pallet-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,12 +1097,9 @@ mod pallet {

// TODO: remove once the migration is done
fn on_runtime_upgrade() -> Weight {
for (domain_id, stake_summary) in DomainStakingSummary::<T>::iter() {
if stake_summary.current_epoch_index.is_zero() {
if let Err(err) = do_finalize_domain_current_epoch::<T>(domain_id, One::one()) {
log::error!(target: "runtime::domains", "Failed to do epoch transition for {domain_id:?}: {err:?}");
}
}
for (domain_id, mut tx_range_state) in DomainTxRangeState::<T>::iter() {
tx_range_state.tx_range = Self::initial_tx_range();
DomainTxRangeState::<T>::set(domain_id, Some(tx_range_state));
}
Weight::zero()
}
Expand Down

0 comments on commit 4a685ef

Please sign in to comment.