🐛 patched for MAX_LOG_SIZE > 0 usecase

This commit is contained in:
EntireTwix 2021-07-19 23:36:19 -07:00
parent dc9b2e70c2
commit b66f2dc562
2 changed files with 2 additions and 4 deletions

View file

@ -13,9 +13,7 @@ struct User
User(uint32_t init_bal, const std::string &init_pass) noexcept; User(uint32_t init_bal, const std::string &init_pass) noexcept;
User(uint32_t init_bal, XXH64_hash_t init_pass) noexcept; User(uint32_t init_bal, XXH64_hash_t init_pass) noexcept;
#if MAX_LOG_SIZE > 0
User(uint32_t init_bal, XXH64_hash_t init_pass, const Json::Value &log_j) noexcept;
#endif
User(const bank_dom::User &u) noexcept; User(const bank_dom::User &u) noexcept;
bank_dom::User Encode() const noexcept; bank_dom::User Encode() const noexcept;
}; };

View file

@ -205,7 +205,7 @@ BankResponse Bank::PruneUsers(time_t threshold_time, uint32_t threshold_bal) noe
{ {
users.erase_if(u.first, [threshold_time, threshold_bal, &deleted_count](User &u) -> bool { users.erase_if(u.first, [threshold_time, threshold_bal, &deleted_count](User &u) -> bool {
#if MAX_LOG_SIZE > 0 #if MAX_LOG_SIZE > 0
if (u.data.back().time < threshold_time && u.balance < threshold_bal) if (u.log.data.back().time < threshold_time && u.balance < threshold_bal)
#else #else
if (u.balance < threshold_bal) if (u.balance < threshold_bal)
#endif #endif