planetmint-go/x/dao/keeper/msg_server_init_pop.go
Jürgen Eckel 3ca10dfff1
Verifying the availability of PoP participants (#274)
* feat: verify the availability of PoP participants

* simplified and improved logging
* added MQTT-based availability check for PoP participants
* extended MQTT mocking
* Only the block proposer will send out the MQTT messages to the pop participants
* Added a configuration value for the MQTT response timeout
* removed parallel execution of one test case
* added r/w locking to the MQTT response processing
* set MQTT timeout unit to ms

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-12 10:02:09 +01:00

29 lines
792 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)
if validResult && msg.Initiator == validatorIdentity {
go util.SendMqttPopInitMessagesToServer(ctx, challenge)
}
return &types.MsgInitPopResponse{}, nil
}