From d857e20dddb2cd04eb8aa2e87a7f5b8a4860c5df Mon Sep 17 00:00:00 2001 From: elvin Date: Mon, 29 Oct 2018 18:39:11 +0800 Subject: [PATCH 1/2] fix bug: Tags.AppendTag do not work --- types/tags.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/tags.go b/types/tags.go index add0c0ad5425..241d49ed01f5 100644 --- a/types/tags.go +++ b/types/tags.go @@ -17,7 +17,8 @@ func EmptyTags() Tags { // Append a single tag func (t Tags) AppendTag(k string, v []byte) Tags { - return append(t, MakeTag(k, v)) + t = append(t, MakeTag(k, v)) + return t } // Append two lists of tags From ba2cf9a161619fb3a4f108bb6cc452f0a945c9b4 Mon Sep 17 00:00:00 2001 From: elvin Date: Wed, 31 Oct 2018 14:18:19 +0800 Subject: [PATCH 2/2] fix bug:Tags append error --- types/tags.go | 3 +-- x/gov/handler.go | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/types/tags.go b/types/tags.go index 241d49ed01f5..add0c0ad5425 100644 --- a/types/tags.go +++ b/types/tags.go @@ -17,8 +17,7 @@ func EmptyTags() Tags { // Append a single tag func (t Tags) AppendTag(k string, v []byte) Tags { - t = append(t, MakeTag(k, v)) - return t + return append(t, MakeTag(k, v)) } // Append two lists of tags diff --git a/x/gov/handler.go b/x/gov/handler.go index 3f8cd312b695..1fd5a4eeab04 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -42,7 +42,7 @@ func handleMsgSubmitProposal(ctx sdk.Context, keeper Keeper, msg MsgSubmitPropos ) if votingStarted { - resTags.AppendTag(tags.VotingPeriodStart, proposalIDBytes) + resTag = resTags.AppendTag(tags.VotingPeriodStart, proposalIDBytes) } return sdk.Result{ @@ -68,7 +68,7 @@ func handleMsgDeposit(ctx sdk.Context, keeper Keeper, msg MsgDeposit) sdk.Result ) if votingStarted { - resTags.AppendTag(tags.VotingPeriodStart, proposalIDBytes) + resTags = resTags.AppendTag(tags.VotingPeriodStart, proposalIDBytes) } return sdk.Result{ @@ -111,8 +111,8 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { proposalIDBytes := keeper.cdc.MustMarshalBinaryBare(inactiveProposal.GetProposalID()) keeper.DeleteProposal(ctx, inactiveProposal) - resTags.AppendTag(tags.Action, tags.ActionProposalDropped) - resTags.AppendTag(tags.ProposalID, proposalIDBytes) + resTags = resTags.AppendTag(tags.Action, tags.ActionProposalDropped) + resTags = resTags.AppendTag(tags.ProposalID, proposalIDBytes) logger.Info( fmt.Sprintf("proposal %d (%s) didn't meet minimum deposit of %v steak (had only %v steak); deleted", @@ -152,8 +152,8 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { logger.Info(fmt.Sprintf("proposal %d (%s) tallied; passed: %v", activeProposal.GetProposalID(), activeProposal.GetTitle(), passes)) - resTags.AppendTag(tags.Action, action) - resTags.AppendTag(tags.ProposalID, proposalIDBytes) + resTags = resTags.AppendTag(tags.Action, action) + resTags = resTags.AppendTag(tags.ProposalID, proposalIDBytes) } return resTags