Skip to content

Commit

Permalink
[Binance private] - Fix recomputation of signature in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Nov 19, 2024
1 parent 25b82a7 commit 12b809d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/api/exchanges/src/binanceprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ void SetNonceAndSignature(const APIKey& apiKey, CurlPostData& postData, Duration

static constexpr std::string_view kSignatureKey = "signature";

if (postData.back().key() == kSignatureKey) {
postData.pop_back();
}
auto sha256Hex = ssl::Sha256Hex(postData.str(), apiKey.privateKey());

postData.set_back(kSignatureKey, std::string_view(sha256Hex));
postData.emplace_back(kSignatureKey, std::string_view(sha256Hex));
}

bool CheckErrorDoRetry(int statusCode, const json::container& ret, QueryDelayDir& queryDelayDir, Duration& sleepingTime,
Expand Down

0 comments on commit 12b809d

Please sign in to comment.