planetmint-go/x/dao/keeper/msg_server_reissue_rddl_proposal.go
Jürgen Eckel f69c978911
added SendRDDLReissuanceResult sending by the proposer after the consensus over the ReissuanceProposal
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-05 17:49:59 +02:00

32 lines
951 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) ReissueRDDLProposal(goCtx context.Context, msg *types.MsgReissueRDDLProposal) (*types.MsgReissueRDDLProposalResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
validator_identity, valid_result := util.GetValidatorCometBFTIdentity(ctx)
if valid_result && msg.Proposer == validator_identity {
// 1. sign tx
// 2. broadcast tx
txID := "asdlkufzaoisdfpoajf"
// 3. notarize result by notarizing the liquid tx-id
util.SendRDDLReissuanceResult(ctx, msg.GetProposer(), txID, msg.GetBlockheight())
}
var reissuance types.Reissuance
reissuance.BlockHeight = msg.GetBlockheight()
reissuance.Proposer = msg.GetProposer()
reissuance.Rawtx = msg.GetTx()
k.StoreReissuance(ctx, reissuance)
return &types.MsgReissueRDDLProposalResponse{}, nil
}