From e21933eb203c26f53809f9ea0db1290bddc94c7c Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 29 Feb 2024 14:17:16 +0800 Subject: [PATCH] cleanup --- x/staking/keeper/keeper.go | 6 ++++++ x/staking/keeper/slash.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index ad9527fd251e..3b6c9ed0083b 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -53,6 +53,12 @@ func NewKeeper( panic(fmt.Sprintf("%s module account has not been set", types.NotBondedPoolName)) } + if forkEnabledFunc == nil { + forkEnabledFunc = func(sdk.Context) bool { + return false + } + } + return Keeper{ storeKey: key, cdc: cdc, diff --git a/x/staking/keeper/slash.go b/x/staking/keeper/slash.go index 23049bdfeb49..7d7556eca1ab 100644 --- a/x/staking/keeper/slash.go +++ b/x/staking/keeper/slash.go @@ -255,7 +255,7 @@ func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, panic(err) } - if k.forkEnabledFunc != nil && k.forkEnabledFunc(ctx) { + if k.forkEnabledFunc(ctx) { // Handle undelegation after redelegation // Prioritize slashing unbondingDelegation than delegation unbondingDelegation, found := k.GetUnbondingDelegation(ctx, sdk.MustAccAddressFromBech32(redelegation.DelegatorAddress), valDstAddr)