From 9927bd82174f60dbe5b9609059af05e93a879c19 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Sat, 10 Jul 2021 21:34:19 -0700 Subject: [PATCH] :bug::fire: fixed logs --- src/bank.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bank.cpp b/src/bank.cpp index 46ba0eb..982f676 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -103,9 +103,9 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam BankResponse state; std::shared_lock lock{save_lock}; //about 10% of this function's cost #if MAX_LOG_SIZE > 0 - static thread_local Transaction temp(a_name, b_name, amount); + Transaction temp(a_name, b_name, amount); #endif - if (!users.modify_if(a_name, [&state, amount](User &a) { + if (!users.modify_if(a_name, [&temp, &state, amount](User &a) { //if A can afford it if (a.balance < amount) { @@ -126,7 +126,7 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam if (state.first == k200OK) { #if MAX_LOG_SIZE > 0 - users.modify_if(b_name, [amount](User &b) { + users.modify_if(b_name, [&temp, amount](User &b) { b.balance += amount; b.log.AddTrans(std::move(temp)); }); //about 40% of this function's cost