mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🐛🔥 fixed logs
This commit is contained in:
parent
8063a344aa
commit
9927bd8217
1 changed files with 3 additions and 3 deletions
|
|
@ -103,9 +103,9 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
||||||
BankResponse state;
|
BankResponse state;
|
||||||
std::shared_lock<std::shared_mutex> lock{save_lock}; //about 10% of this function's cost
|
std::shared_lock<std::shared_mutex> lock{save_lock}; //about 10% of this function's cost
|
||||||
#if MAX_LOG_SIZE > 0
|
#if MAX_LOG_SIZE > 0
|
||||||
static thread_local Transaction temp(a_name, b_name, amount);
|
Transaction temp(a_name, b_name, amount);
|
||||||
#endif
|
#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 can afford it
|
||||||
if (a.balance < amount)
|
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 (state.first == k200OK)
|
||||||
{
|
{
|
||||||
#if MAX_LOG_SIZE > 0
|
#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.balance += amount;
|
||||||
b.log.AddTrans(std::move(temp));
|
b.log.AddTrans(std::move(temp));
|
||||||
}); //about 40% of this function's cost
|
}); //about 40% of this function's cost
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue