Log dcrutil.Amount rather than float

This commit is contained in:
jholdstock 2020-06-06 11:53:18 +01:00 committed by David Hill
parent 3136038746
commit 443db9a7b9

View File

@ -37,7 +37,7 @@ func getNewFeeAddress(db *database.VspDatabase, addrGen *addressGenerator) (stri
return addr, idx, nil return addr, idx, nil
} }
func getCurrentFee(dcrdClient *rpc.DcrdRPC) (float64, error) { func getCurrentFee(dcrdClient *rpc.DcrdRPC) (dcrutil.Amount, error) {
bestBlock, err := dcrdClient.GetBestBlockHeader() bestBlock, err := dcrdClient.GetBestBlockHeader()
if err != nil { if err != nil {
return 0, err return 0, err
@ -56,7 +56,7 @@ func getCurrentFee(dcrdClient *rpc.DcrdRPC) (float64, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
return fee.ToCoin(), nil return fee, nil
} }
// feeAddress is the handler for "POST /feeaddress". // feeAddress is the handler for "POST /feeaddress".
@ -124,7 +124,7 @@ func feeAddress(c *gin.Context) {
return return
} }
ticket.FeeExpiration = now.Add(cfg.FeeAddressExpiration).Unix() ticket.FeeExpiration = now.Add(cfg.FeeAddressExpiration).Unix()
ticket.FeeAmount = newFee ticket.FeeAmount = newFee.ToCoin()
err = db.UpdateTicket(ticket) err = db.UpdateTicket(ticket)
if err != nil { if err != nil {
@ -172,7 +172,7 @@ func feeAddress(c *gin.Context) {
FeeAddressIndex: newAddressIdx, FeeAddressIndex: newAddressIdx,
FeeAddress: newAddress, FeeAddress: newAddress,
Confirmed: confirmed, Confirmed: confirmed,
FeeAmount: fee, FeeAmount: fee.ToCoin(),
FeeExpiration: expire, FeeExpiration: expire,
// VotingKey and VoteChoices: set during payfee // VotingKey and VoteChoices: set during payfee
} }
@ -185,13 +185,13 @@ func feeAddress(c *gin.Context) {
} }
log.Debugf("Fee address created for new ticket: tktConfirmed=%t, feeAddrIdx=%d, "+ log.Debugf("Fee address created for new ticket: tktConfirmed=%t, feeAddrIdx=%d, "+
"feeAddr=%s, feeAmt=%f, ticketHash=%s", confirmed, newAddressIdx, newAddress, fee, ticketHash) "feeAddr=%s, feeAmt=%s, ticketHash=%s", confirmed, newAddressIdx, newAddress, fee, ticketHash)
sendJSONResponse(feeAddressResponse{ sendJSONResponse(feeAddressResponse{
Timestamp: now.Unix(), Timestamp: now.Unix(),
Request: feeAddressRequest, Request: feeAddressRequest,
FeeAddress: newAddress, FeeAddress: newAddress,
FeeAmount: fee, FeeAmount: fee.ToCoin(),
Expiration: expire, Expiration: expire,
}, c) }, c)
} }