From 880d6b5b71239a3d0552eab9bcba7379ec006d43 Mon Sep 17 00:00:00 2001 From: j75689 Date: Thu, 5 Jan 2023 20:33:13 +0800 Subject: [PATCH] fix: tolerate nil initializer --- x/upgrade/keeper/keeper.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 1d371885f6..6e63bd407f 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -3,7 +3,6 @@ package keeper import ( "encoding/binary" "encoding/json" - "fmt" "os" "path" "path/filepath" @@ -32,7 +31,6 @@ type Keeper struct { } // NewKeeper constructs an upgrade Keeper which requires the following arguments: -// skipUpgradeHeights - map of heights to skip an upgrade // storeKey - a store key with which to access upgrade's store // cdc - the app-wide binary codec // homePath - root directory of the application's config @@ -327,7 +325,6 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) { initializer := k.upgradeInitializer[plan.Name] if initializer == nil { ctx.Logger().Error("missing initializer to upgrade [" + plan.Name + "]") - return } err := initializer() @@ -439,7 +436,7 @@ func (k Keeper) InitUpgraded(ctx sdk.Context) error { if height < ctx.BlockHeight() { f := k.upgradeInitializer[upgradeName] if f == nil { - return fmt.Errorf("missing initializer for the upgrade [" + upgradeName + "]") + k.Logger(ctx).Error("missing initializer for the upgrade [" + upgradeName + "]") } err := f()