Skip to content

Commit

Permalink
check is ok
Browse files Browse the repository at this point in the history
  • Loading branch information
aquarius-kuchain committed Oct 20, 2020
1 parent 7617d68 commit baf60a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
4 changes: 4 additions & 0 deletions utils/version/checkok.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
DiffBlockBy051 = 657925
)

func MakeOk(ctx sdk.Context) {
switch ctx.BlockHeight() {
case 567025:
Expand Down
26 changes: 17 additions & 9 deletions x/staking/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

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

name, ok := delegatorAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
name, ok := delegatorAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
}
}

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

name, ok := delAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
name, ok := delAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
}
}

store := ctx.KVStore(k.storeKey)
prefix := types.GetREDsByDelToValDstIndexKey(delAddr, valDstAddr)
iterator := sdk.KVStorePrefixIterator(store, prefix)
Expand All @@ -351,9 +357,11 @@ func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context,
delegatorAddr AccountID, validatorSrcAddr,
validatorDstAddr AccountID) bool {

name, ok := delegatorAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
if ctx.BlockHeight() >= (version.DiffBlockBy051 - 5) {
name, ok := delegatorAddr.ToName()
if ok && constants.IsSystemAccount(name) {
return false
}
}

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

0 comments on commit baf60a5

Please sign in to comment.