mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-18 09:02:14 +11:00
🐎 stopping sendfund calls to self
This commit is contained in:
parent
4ffc88b54d
commit
00a8e034c8
1 changed files with 7 additions and 0 deletions
|
|
@ -60,6 +60,13 @@ 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;
|
bool state = false;
|
||||||
|
|
||||||
|
//cant send money to self, from self
|
||||||
|
if (a_name == b_name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_lock<std::shared_mutex> lock{save_lock}; //because SendFunds requires 3 locking operations
|
std::shared_lock<std::shared_mutex> lock{save_lock}; //because SendFunds requires 3 locking operations
|
||||||
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 == attempt), state)
|
if (state = (a.balance >= amount) && (a.password == attempt), state)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue