mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 fixed last commit
This commit is contained in:
parent
113a765c14
commit
6d6b55025b
1 changed files with 8 additions and 2 deletions
10
src/bank.cpp
10
src/bank.cpp
|
|
@ -115,7 +115,9 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
||||||
users.modify_if(b_name, [&a_name, &b_name, amount](User &b) {
|
users.modify_if(b_name, [&a_name, &b_name, amount](User &b) {
|
||||||
b.balance += amount;
|
b.balance += amount;
|
||||||
});
|
});
|
||||||
|
#if CONSERVATIVE_DISK_SAVE
|
||||||
ChangesMade();
|
ChangesMade();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
@ -131,18 +133,22 @@ bool Bank::VerifyPassword(const std::string &name, const std::string &attempt) c
|
||||||
|
|
||||||
void Bank::ChangePassword(const std::string &name, std::string &&new_pass) noexcept
|
void Bank::ChangePassword(const std::string &name, std::string &&new_pass) noexcept
|
||||||
{
|
{
|
||||||
users.modify_if(name, [this, &new_pass](User &u) {
|
users.modify_if(name, [&new_pass](User &u) {
|
||||||
u.password = XXH3_64bits(new_pass.data(), new_pass.size());
|
u.password = XXH3_64bits(new_pass.data(), new_pass.size());
|
||||||
});
|
});
|
||||||
|
#if CONSERVATIVE_DISK_SAVE
|
||||||
ChangesMade();
|
ChangesMade();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
BankResponse Bank::SetBal(const std::string &name, uint32_t amount) noexcept
|
BankResponse Bank::SetBal(const std::string &name, uint32_t amount) noexcept
|
||||||
{
|
{
|
||||||
if (users.modify_if(name, [this, amount](User &u) {
|
if (users.modify_if(name, [amount](User &u) {
|
||||||
u.balance = amount;
|
u.balance = amount;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
|
#if CONSERVATIVE_DISK_SAVE
|
||||||
ChangesMade();
|
ChangesMade();
|
||||||
|
#endif
|
||||||
return BankResponse(k200OK, "Balance set!");
|
return BankResponse(k200OK, "Balance set!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue