🐎 SendFunds lock time decreased

This commit is contained in:
EntireTwix 2021-04-21 15:44:27 -07:00
parent 32ea81bac2
commit 491f5f9adf

View file

@ -80,8 +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())))
{ {
@ -103,6 +104,7 @@ public:
state = false; //because had to refund transaction state = false; //because had to refund transaction
} }
} }
}
if (state) if (state)
{ {