From 588c56a6cc50ef5d128e18f7ab98b8467c44d29e Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Wed, 21 Apr 2021 15:46:37 -0700 Subject: [PATCH] :bug: fixed state bug --- include/bank.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/bank.hpp b/include/bank.hpp index 107892a..fb136ee 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -80,9 +80,9 @@ public: } //if A exists, A can afford it, and A's password matches + bool state = false; { std::shared_lock lock{send_funds_l}; //because SendFunds requires 3 locking operations - bool state = false; users.modify_if(a_name, [&state, amount, &attempt](User &a) { if (state = (a.balance >= amount) && (a.password == XXH3_64bits(attempt.data(), attempt.size()))) { @@ -192,8 +192,9 @@ public: res[99 - i]["recieving"] = l.data[i].recieving; } }); + return res; } - return res; + return -1; } void Save()