From 5e253e42d937c8013104108a91fba31b1d330b88 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Sun, 18 Dec 2022 17:22:12 -0800 Subject: [PATCH] :bug: fixing last commit --- src/bank.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bank.cpp b/src/bank.cpp index 08ba3a1..ff0c9e9 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -232,16 +232,26 @@ BankResponse Bank::PruneUsers(uint32_t threshold_bal) noexcept #endif for (const auto &u : users) { + +#if MAX_LOG_SIZE > 0 + #if RETURN_ON_DEL - if (Bank::users.erase_if(u.first, [threshold_bal, &bal, &deleted_count](User &u) { + if (Bank::users.erase_if(u.first, [threshold_time, threshold_bal, &bal, &deleted_count](User &u) { bal += u.balance; #else if (Bank::users.erase_if(u.first, [threshold_time, threshold_bal, &deleted_count](User &u) { #endif -#if MAX_LOG_SIZE > 0 return ((!u.log.data.size() || u.log.data.back().time < threshold_time) && u.balance < threshold_bal); #else + +#if RETURN_ON_DEL + if (Bank::users.erase_if(u.first, [threshold_bal, &bal, &deleted_count](User &u) { + bal += u.balance; +#else + if (Bank::users.erase_if(u.first, [threshold_bal, &deleted_count](User &u) { +#endif return (u.balance < threshold_bal); + #endif })) {