Last active
January 29, 2019 19:08
-
-
Save xotonic/51ffc8d8400c93e552c94115c1d51396 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OrderId COrder::ComputeId() | |
{ | |
if (cachedOrderId == 0) { | |
std::vector<unsigned char> vchId; | |
vchId.resize(256); | |
auto it = vchId.begin(); | |
*it = base == "LUX" ? 0 : 1; | |
it++; | |
*it = rel == "LUX" ? 0 : 1; | |
it++; | |
std::copy_n(&baseAmount, sizeof(uint64_t), it); | |
it = std::next(it, sizeof(uint64_t)); | |
std::copy_n(&relAmount, sizeof(uint64_t), it); | |
it = std::next(it, sizeof(uint64_t)); | |
std::copy_n(&orderCreationTime, sizeof(uint64_t), it); | |
cachedOrderId = uint256(vchId); | |
LogPrintf("ComputeId: %s %s %s %s %s = %s\n", base, rel, baseAmount, relAmount, orderCreationTime, cachedOrderId.ToString()); | |
} | |
return cachedOrderId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment