apply various pr suggestions

This commit is contained in:
rhuairahrighairigh 2020-04-28 01:51:53 +01:00
parent d1c0dd18b1
commit ffbeced199
2 changed files with 27 additions and 25 deletions

View File

@ -57,18 +57,29 @@ func handleMsgVote(ctx sdk.Context, k keeper.Keeper, msg types.MsgVote) (*sdk.Re
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Voter.String()),
),
)
// Enact a proposal if it has enough votes
passes, err := k.GetProposalResult(ctx, msg.ProposalID)
if err != nil {
return nil, err
}
if passes {
if !passes {
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
}
err = k.EnactProposal(ctx, msg.ProposalID)
outcome := types.AttributeValueProposalPassed
if err != nil {
outcome = types.AttributeValueProposalFailed
}
k.DeleteProposalAndVotes(ctx, msg.ProposalID)
ctx.EventManager().EmitEvent(
@ -79,15 +90,6 @@ func handleMsgVote(ctx sdk.Context, k keeper.Keeper, msg types.MsgVote) (*sdk.Re
sdk.NewAttribute(types.AttributeKeyProposalCloseStatus, outcome),
),
)
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Voter.String()),
),
)
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
}

View File

@ -9,7 +9,7 @@ import (
"gopkg.in/yaml.v2"
)
const MaxCommitteeDescriptionLength int = 5000
const MaxCommitteeDescriptionLength int = 512
// ------------------------------------------
// Committees