Use actual request in response, dont reserialize. (#220)

Reserializing the client request can result in different bytes because
the order of iteration over a map is not guaranteed to be the same every
time.
This commit is contained in:
Jamie Holdstock 2020-12-30 12:36:06 +00:00 committed by GitHub
parent 268d293749
commit ac8e20f3c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 20 deletions

View File

@ -147,7 +147,7 @@ func feeAddress(c *gin.Context) {
}
sendJSONResponse(feeAddressResponse{
Timestamp: now.Unix(),
Request: request,
Request: reqBytes,
FeeAddress: ticket.FeeAddress,
FeeAmount: ticket.FeeAmount,
Expiration: ticket.FeeExpiration,
@ -200,7 +200,7 @@ func feeAddress(c *gin.Context) {
sendJSONResponse(feeAddressResponse{
Timestamp: now.Unix(),
Request: request,
Request: reqBytes,
FeeAddress: newAddress,
FeeAmount: int64(fee),
Expiration: expire,

View File

@ -276,7 +276,7 @@ findAddress:
// Send success response to client.
resp, respSig := sendJSONResponse(payFeeResponse{
Timestamp: time.Now().Unix(),
Request: request,
Request: reqBytes,
}, c)
// Store a record of the vote choice change.

View File

@ -134,7 +134,7 @@ func setVoteChoices(c *gin.Context) {
// Send success response to client.
resp, respSig := sendJSONResponse(setVoteChoicesResponse{
Timestamp: time.Now().Unix(),
Request: request,
Request: reqBytes,
}, c)
// Store a record of the vote choice change.

View File

@ -36,7 +36,7 @@ func ticketStatus(c *gin.Context) {
sendJSONResponse(ticketStatusResponse{
Timestamp: time.Now().Unix(),
Request: request,
Request: reqBytes,
TicketConfirmed: ticket.Confirmed,
FeeTxStatus: string(ticket.FeeTxStatus),
FeeTxHash: ticket.FeeTxHash,

View File

@ -29,7 +29,7 @@ type feeAddressResponse struct {
FeeAddress string `json:"feeaddress"`
FeeAmount int64 `json:"feeamount"`
Expiration int64 `json:"expiration"`
Request feeAddressRequest `json:"request"`
Request []byte `json:"request"`
}
type payFeeRequest struct {
@ -42,7 +42,7 @@ type payFeeRequest struct {
type payFeeResponse struct {
Timestamp int64 `json:"timestamp"`
Request payFeeRequest `json:"request"`
Request []byte `json:"request"`
}
type setVoteChoicesRequest struct {
@ -53,7 +53,7 @@ type setVoteChoicesRequest struct {
type setVoteChoicesResponse struct {
Timestamp int64 `json:"timestamp"`
Request setVoteChoicesRequest `json:"request"`
Request []byte `json:"request"`
}
type ticketStatusRequest struct {
@ -66,5 +66,5 @@ type ticketStatusResponse struct {
FeeTxStatus string `json:"feetxstatus"`
FeeTxHash string `json:"feetxhash"`
VoteChoices map[string]string `json:"votechoices"`
Request ticketStatusRequest `json:"request"`
Request []byte `json:"request"`
}