🐛 fixed state bug

This commit is contained in:
EntireTwix 2021-04-21 15:46:37 -07:00
parent 491f5f9adf
commit 588c56a6cc

View file

@ -80,9 +80,9 @@ public:
} }
//if A exists, A can afford it, and A's password matches //if A exists, A can afford it, and A's password matches
bool state = false;
{ {
std::shared_lock<std::shared_mutex> lock{send_funds_l}; //because SendFunds requires 3 locking operations std::shared_lock<std::shared_mutex> lock{send_funds_l}; //because SendFunds requires 3 locking operations
bool state = false;
users.modify_if(a_name, [&state, amount, &attempt](User &a) { users.modify_if(a_name, [&state, amount, &attempt](User &a) {
if (state = (a.balance >= amount) && (a.password == XXH3_64bits(attempt.data(), attempt.size()))) if (state = (a.balance >= amount) && (a.password == XXH3_64bits(attempt.data(), attempt.size())))
{ {
@ -192,9 +192,10 @@ public:
res[99 - i]["recieving"] = l.data[i].recieving; res[99 - i]["recieving"] = l.data[i].recieving;
} }
}); });
}
return res; return res;
} }
return -1;
}
void Save() void Save()
{ {