mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🐎 SendFunds lock time decreased
This commit is contained in:
parent
32ea81bac2
commit
491f5f9adf
1 changed files with 21 additions and 19 deletions
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue