Add tags for declare & edit candidacy txs

This commit is contained in:
Christopher Goes 2018-05-10 21:55:51 +02:00
parent 0ec21e4e27
commit a2f5855d8e
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
2 changed files with 8 additions and 3 deletions

View File

@ -31,7 +31,7 @@ FEATURES:
* Add (non-proof) subspace query helper functions
* Add more staking query functions: candidates, delegator-bonds
* Bank module now tags transactions with sender/recipient for indexing & later retrieval
* Stake module now tags transactions with delegator/candidate for delegation & unbonding
* Stake module now tags transactions with delegator/candidate for delegation & unbonding, and candidate info for declare candidate / edit candidacy
BUG FIXES
* Gaia now uses stake, ported from github.com/cosmos/gaia

View File

@ -97,13 +97,15 @@ func handleMsgDeclareCandidacy(ctx sdk.Context, msg MsgDeclareCandidacy, k Keepe
candidate := NewCandidate(msg.CandidateAddr, msg.PubKey, msg.Description)
k.setCandidate(ctx, candidate)
tags := sdk.NewTags("action", []byte("declareCandidacy"), "candidate", msg.CandidateAddr.Bytes(), "moniker", []byte(msg.Description.Moniker), "identity", []byte(msg.Description.Identity))
// move coins from the msg.Address account to a (self-bond) delegator account
// the candidate account and global shares are updated within here
tags, err := delegate(ctx, k, msg.CandidateAddr, msg.Bond, candidate)
delegateTags, err := delegate(ctx, k, msg.CandidateAddr, msg.Bond, candidate)
if err != nil {
return err.Result()
}
tags = tags.AppendTags(delegateTags)
return sdk.Result{
Tags: tags,
}
@ -130,7 +132,10 @@ func handleMsgEditCandidacy(ctx sdk.Context, msg MsgEditCandidacy, k Keeper) sdk
candidate.Description.Details = msg.Description.Details
k.setCandidate(ctx, candidate)
return sdk.Result{}
tags := sdk.NewTags("action", []byte("editCandidacy"), "candidate", msg.CandidateAddr.Bytes(), "moniker", []byte(msg.Description.Moniker), "identity", []byte(msg.Description.Identity))
return sdk.Result{
Tags: tags,
}
}
func handleMsgDelegate(ctx sdk.Context, msg MsgDelegate, k Keeper) sdk.Result {