Skip to content

Commit baf60a5

Browse files
check is ok
1 parent 7617d68 commit baf60a5

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

utils/version/checkok.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import (
44
sdk "github.com/cosmos/cosmos-sdk/types"
55
)
66

7+
const (
8+
DiffBlockBy051 = 657925
9+
)
10+
711
func MakeOk(ctx sdk.Context) {
812
switch ctx.BlockHeight() {
913
case 567025:

x/staking/keeper/delegation.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
"github.com/KuChainNetwork/kuchain/chain/constants"
9+
"github.com/KuChainNetwork/kuchain/utils/version"
910
stakingexport "github.com/KuChainNetwork/kuchain/x/staking/exported"
1011
"github.com/KuChainNetwork/kuchain/x/staking/types"
1112
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -171,9 +172,11 @@ func (k Keeper) IterateUnbondingDelegations(ctx sdk.Context, fn func(index int64
171172
func (k Keeper) HasMaxUnbondingDelegationEntries(ctx sdk.Context,
172173
delegatorAddr AccountID, validatorAddr AccountID) bool {
173174

174-
name, ok := delegatorAddr.ToName()
175-
if ok && constants.IsSystemAccount(name) {
176-
return false
175+
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
176+
name, ok := delegatorAddr.ToName()
177+
if ok && constants.IsSystemAccount(name) {
178+
return false
179+
}
177180
}
178181

179182
ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr)
@@ -334,10 +337,13 @@ func (k Keeper) GetRedelegationsFromSrcValidator(ctx sdk.Context, valAddr Accoun
334337
func (k Keeper) HasReceivingRedelegation(ctx sdk.Context,
335338
delAddr AccountID, valDstAddr AccountID) bool {
336339

337-
name, ok := delAddr.ToName()
338-
if ok && constants.IsSystemAccount(name) {
339-
return false
340+
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
341+
name, ok := delAddr.ToName()
342+
if ok && constants.IsSystemAccount(name) {
343+
return false
344+
}
340345
}
346+
341347
store := ctx.KVStore(k.storeKey)
342348
prefix := types.GetREDsByDelToValDstIndexKey(delAddr, valDstAddr)
343349
iterator := sdk.KVStorePrefixIterator(store, prefix)
@@ -351,9 +357,11 @@ func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context,
351357
delegatorAddr AccountID, validatorSrcAddr,
352358
validatorDstAddr AccountID) bool {
353359

354-
name, ok := delegatorAddr.ToName()
355-
if ok && constants.IsSystemAccount(name) {
356-
return false
360+
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
361+
name, ok := delegatorAddr.ToName()
362+
if ok && constants.IsSystemAccount(name) {
363+
return false
364+
}
357365
}
358366

359367
red, found := k.GetRedelegation(ctx, delegatorAddr, validatorSrcAddr, validatorDstAddr)

0 commit comments

Comments
 (0)