🐎 stopping sendfund calls to self

This commit is contained in:
EntireTwix 2021-04-08 20:24:46 -07:00
parent 4ffc88b54d
commit 00a8e034c8

View file

@ -60,6 +60,13 @@ public:
{
//if A exists, A can afford it, and A's password matches
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
users.modify_if(a_name, [&state, amount, &attempt](User &a) {
if (state = (a.balance >= amount) && (a.password == attempt), state)