planetmint-go/x/dao/keeper/msg_server_init_pop.go
Jürgen Eckel 4f5b1e5777
Multi validator setup in test cases (#333)
* Initializing rootDir of dao and machine keeper with the home path of the validator key material
* added Block height logging of context decorator
* removed SetRoot usage
* fixed data races of the attest machine go-routine
* reproduction of the issue
* fixed testing URL issue
* refactored the machine-nft functions/mock
* fixed keeper.param read-bug that increased the gas prices in an inconsistent way
* increased the validator number to 3 for all e2e tests
* added go routine to attest machine workflow

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: Julian Strobl <jmastr@mailbox.org>
Co-authored-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-03-05 11:37:01 +01:00

29 lines
803 B
Go

package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/util"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k msgServer) InitPop(goCtx context.Context, msg *types.MsgInitPop) (*types.MsgInitPopResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
var challenge types.Challenge
challenge.Initiator = msg.GetInitiator()
challenge.Challengee = msg.GetChallengee()
challenge.Challenger = msg.GetChallenger()
challenge.Height = msg.GetHeight()
k.StoreChallenge(ctx, challenge)
validatorIdentity, validResult := util.GetValidatorCometBFTIdentity(ctx, k.RootDir)
if validResult && msg.Initiator == validatorIdentity {
go util.SendMqttPopInitMessagesToServer(ctx, challenge)
}
return &types.MsgInitPopResponse{}, nil
}