Skip to content

Commit

Permalink
time value fix and upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Oct 22, 2024
1 parent 87774e1 commit 7a83edc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (app App) RegisterUpgradeHandlers() {
app.registerUpgrade0_4_1(upgradeInfo)
app.registerUpgrade0_5_0(upgradeInfo)
app.registerUpgrade0_5_1(upgradeInfo)
app.registerUpgrade0_5_2(upgradeInfo)
}

// performs upgrade from v0.1.3 to v0.1.4
Expand Down Expand Up @@ -374,6 +375,23 @@ func (app *App) registerUpgrade0_5_1(_ upgradetypes.Plan) {
)
}

func (app *App) registerUpgrade0_5_2(_ upgradetypes.Plan) {
const planName = "v0.5.2"
app.UpgradeKeeper.SetUpgradeHandler(planName,
func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
sdkCtx.Logger().Info("Upgrade handler execution", "name", planName)

// delete all payments in the store before upgrade
payments := app.GmpKeeper.GetAllPayments(sdkCtx)
for _, payment := range payments {
app.GmpKeeper.DeletePayment(sdkCtx, payment)
}
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)
}

// helper function to check if the store loader should be upgraded
func (app *App) storeUpgrade(planName string, ui upgradetypes.Plan, stores storetypes.StoreUpgrades) {
if ui.Name == planName && !app.UpgradeKeeper.IsSkipHeight(ui.Height) {
Expand Down
2 changes: 1 addition & 1 deletion x/gmp/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (k Keeper) ProcessPayment(
[]string{payment.Denom},
types.EmptyByteSlice,
types.EmptyByteSlice,
time.Now().Unix(),
ctx.BlockTime().Unix(),
)
_, err = k.RelayPrice(goCtx, msg)
if err != nil {
Expand Down

0 comments on commit 7a83edc

Please sign in to comment.