Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Add timestamp to ticket vote. #1395

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions politeiad/backendv2/tstorebe/plugins/ticketvote/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ func (p *ticketVotePlugin) ballot(token []byte, votes []ticketvote.CastVote, br
Signature: v.Signature,
Address: addr,
Receipt: hex.EncodeToString(receipt[:]),
Timestamp: time.Now().Unix(),
}

// Save cast vote details
Expand Down
5 changes: 3 additions & 2 deletions politeiad/plugins/ticketvote/ticketvote.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ type CastVoteDetails struct {
Signature string `json:"signature"` // Client signature

// Metdata generated by server
Address string `json:"address"` // Largest commitment address
Receipt string `json:"receipt"` // Server signature
Address string `json:"address"` // Largest commitment address
Receipt string `json:"receipt"` // Server signature
Timestamp int64 `json:"timestamp"` // Unix timestamp
}

// AuthActionT represents the ticket vote authorization actions.
Expand Down
1 change: 1 addition & 0 deletions politeiawww/api/ticketvote/v1/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ type CastVoteDetails struct {
Address string `json:"address"` // Address used in client signature
Signature string `json:"signature"` // Client signature
Receipt string `json:"receipt"` // Server sig of client sig
Timestamp int64 `json:"timestamp"` // Unix timestamp
}

// Results returns the cast votes for a record.
Expand Down
1 change: 1 addition & 0 deletions politeiawww/ticketvote/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ func convertCastVoteDetailsToV1(votes []ticketvote.CastVoteDetails) []v1.CastVot
Address: v.Address,
Signature: v.Signature,
Receipt: v.Receipt,
Timestamp: v.Timestamp,
})
}
return vs
Expand Down