diff --git a/webapi/getfeeaddress.go b/webapi/getfeeaddress.go index ff569a4..8751400 100644 --- a/webapi/getfeeaddress.go +++ b/webapi/getfeeaddress.go @@ -83,6 +83,13 @@ func feeAddress(c *gin.Context) { ticketHash := feeAddressRequest.TicketHash + // Respond early if we already have the fee tx for this ticket. + if ticket.FeeTxHex != "" { + log.Warnf("Fee tx already received from %s: ticketHash=%s", c.ClientIP(), ticket.Hash) + sendErrorResponse("fee tx already received", http.StatusBadRequest, c) + return + } + canVote, err := dcrdClient.CanTicketVote(ticketHash, cfg.NetParams) if err != nil { log.Errorf("canTicketVote error: %v", err) @@ -98,13 +105,6 @@ func feeAddress(c *gin.Context) { // VSP already knows this ticket and has already issued it a fee address. if knownTicket { - // Respond early if we already have the fee tx for this ticket. - if ticket.FeeTxHex != "" { - log.Warnf("Fee tx already received from %s: ticketHash=%s", c.ClientIP(), ticket.Hash) - sendErrorResponse("fee tx already received", http.StatusBadRequest, c) - return - } - // If the expiry period has passed we need to issue a new fee. now := time.Now() if ticket.FeeExpired() {