mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-11-16 17:27:39 +00:00
Fix spend tracking bug in db::storage (#89)
This commit is contained in:
parent
9446758fdb
commit
9f98d2a8c9
2 changed files with 8 additions and 2 deletions
|
@ -217,8 +217,8 @@ namespace db
|
||||||
{
|
{
|
||||||
transaction_link link; //!< Orders and links `spend` to `output`.
|
transaction_link link; //!< Orders and links `spend` to `output`.
|
||||||
crypto::key_image image; //!< Unique ID for the spend
|
crypto::key_image image; //!< Unique ID for the spend
|
||||||
// `link` and `image` must in this order for LMDB optimizations
|
|
||||||
output_id source; //!< The output being spent
|
output_id source; //!< The output being spent
|
||||||
|
// `link`, `image`, and `source` must in this order for LMDB optimizations
|
||||||
std::uint64_t timestamp; //!< Timestamp of spend
|
std::uint64_t timestamp; //!< Timestamp of spend
|
||||||
std::uint64_t unlock_time;//!< Unlock time of spend
|
std::uint64_t unlock_time;//!< Unlock time of spend
|
||||||
std::uint32_t mixin_count;//!< Ring-size of TX output
|
std::uint32_t mixin_count;//!< Ring-size of TX output
|
||||||
|
|
|
@ -219,7 +219,13 @@ namespace db
|
||||||
right_bytes.remove_prefix(sizeof(crypto::hash));
|
right_bytes.remove_prefix(sizeof(crypto::hash));
|
||||||
|
|
||||||
static_assert(sizeof(crypto::key_image) == 32, "bad memcmp below");
|
static_assert(sizeof(crypto::key_image) == 32, "bad memcmp below");
|
||||||
return compare_32bytes(left_bytes, right_bytes);
|
diff = compare_32bytes(left_bytes, right_bytes);
|
||||||
|
if (diff)
|
||||||
|
return diff;
|
||||||
|
|
||||||
|
left_bytes.remove_prefix(sizeof(crypto::key_image));
|
||||||
|
right_bytes.remove_prefix(sizeof(crypto::key_image));
|
||||||
|
return less<output_id>(left_bytes, right_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const lmdb::basic_table<unsigned, block_info> blocks{
|
constexpr const lmdb::basic_table<unsigned, block_info> blocks{
|
||||||
|
|
Loading…
Reference in a new issue