2019-07-05 05:34:02 -07:00
|
|
|
package v0_36
|
|
|
|
|
|
|
|
import (
|
|
|
|
v034distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v0_34"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36
|
|
|
|
// genesis state. All entries are identical except for validator slashing events
|
|
|
|
// which now include the period.
|
|
|
|
func Migrate(oldGenState v034distr.GenesisState) GenesisState {
|
|
|
|
// migrate slash events which now have the period included
|
|
|
|
slashEvents := make([]ValidatorSlashEventRecord, len(oldGenState.ValidatorSlashEvents))
|
|
|
|
for i, se := range oldGenState.ValidatorSlashEvents {
|
|
|
|
slashEvents[i] = ValidatorSlashEventRecord{
|
|
|
|
ValidatorAddress: se.ValidatorAddress,
|
|
|
|
Height: se.Height,
|
|
|
|
Period: se.Event.ValidatorPeriod,
|
2019-07-18 05:43:56 -07:00
|
|
|
Event: se.Event,
|
2019-07-05 05:34:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewGenesisState(
|
2019-07-18 05:43:56 -07:00
|
|
|
oldGenState.FeePool, oldGenState.CommunityTax, oldGenState.BaseProposerReward,
|
2019-07-05 05:34:02 -07:00
|
|
|
oldGenState.BonusProposerReward, oldGenState.WithdrawAddrEnabled,
|
2019-07-18 05:43:56 -07:00
|
|
|
oldGenState.DelegatorWithdrawInfos, oldGenState.PreviousProposer,
|
|
|
|
oldGenState.OutstandingRewards, oldGenState.ValidatorAccumulatedCommissions,
|
|
|
|
oldGenState.ValidatorHistoricalRewards, oldGenState.ValidatorCurrentRewards,
|
|
|
|
oldGenState.DelegatorStartingInfos, slashEvents,
|
2019-07-05 05:34:02 -07:00
|
|
|
)
|
|
|
|
}
|