mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-25 23:15:45 +00:00
* 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>
29 lines
792 B
Go
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
|
|
}
|