Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Revert nonce handling
Browse files Browse the repository at this point in the history
  • Loading branch information
KopfKrieg committed Sep 2, 2016
1 parent 0d69142 commit b14858a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ func (tapi *TradeAPI) RedeemCouponAuth(key string, secret string, coupon string)
}

func (tapi *TradeAPI) encodePostData(method string, params map[string]string) string {
if tapi.lastNonce == 0 {
tapi.lastNonce = time.Now().Unix()
nonce := time.Now().Unix()
if nonce <= tapi.lastNonce {
nonce = tapi.lastNonce + 1
}
tapi.lastNonce += 1
result := fmt.Sprintf("method=%s&nonce=%d", method, tapi.lastNonce)
tapi.lastNonce = nonce

result := fmt.Sprintf("method=%s&nonce=%d", method, nonce)

if len(params) > 0 {
v := url.Values{}
Expand Down

0 comments on commit b14858a

Please sign in to comment.