diff --git a/simulation/operations.go b/simulation/operations.go index 552fb68..d0de294 100644 --- a/simulation/operations.go +++ b/simulation/operations.go @@ -1,6 +1,7 @@ package simulation import ( + "fmt" "math" "math/rand" "os" @@ -119,6 +120,18 @@ func SimulateMsgCreateValidator(txGen client.TxConfig, k keeper.Keeper) simtypes description := generateRandomDescription(r) commission := generateRandomCommission(r) + vals, err := k.PendingValidators.Get(ctx) + if err != nil { + return simtypes.OperationMsg{}, nil, nil + } + for _, v := range vals.Validators { + if v.OperatorAddress == address.String() { + fmt.Println(v.OperatorAddress, address.String()) + fmt.Println("skipping due to validator already being in PendingValidators") + return simtypes.OperationMsg{}, nil, nil + } + } + msg, err := poatypes.NewMsgCreateValidator(address.String(), simAccount.ConsKey.PubKey(), description, commission, selfDelegation.Amount) if err != nil { return simtypes.NoOpMsg(poatypes.ModuleName, msgType, errors.WithMessage(err, "unable to create MsgCreateValidator").Error()), nil, err