mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🐎 Transaction names moved in
This commit is contained in:
parent
ec9944d80e
commit
69ff81c727
3 changed files with 7 additions and 7 deletions
|
|
@ -10,6 +10,6 @@ struct Transaction
|
|||
time_t time = 0;
|
||||
|
||||
Transaction();
|
||||
Transaction(std::string from_str, std::string to_str, uint32_t amount, time_t time);
|
||||
Transaction(std::string from_str, std::string to_str, uint32_t amount);
|
||||
Transaction(std::string &&from_str, std::string &&to_str, uint32_t amount, time_t time);
|
||||
Transaction(std::string &&from_str, std::string &&to_str, uint32_t amount);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
|||
BankResponse state;
|
||||
std::shared_lock<std::shared_mutex> lock{send_funds_l}; //about 10% of this function's cost
|
||||
#if MAX_LOG_SIZE > 0
|
||||
Transaction temp(a_name, b_name, amount);
|
||||
Transaction temp(std::string(a_name), std::string(b_name), amount);
|
||||
if (!users.modify_if(a_name, [&temp, &state, amount](User &a) {
|
||||
#else
|
||||
if (!users.modify_if(a_name, [&state, amount](User &a) {
|
||||
|
|
@ -102,7 +102,7 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
|||
bool Bank::VerifyPassword(std::string_view name, std::string_view attempt) const noexcept
|
||||
{
|
||||
bool res = false;
|
||||
users.if_contains(std::string(name), [&res, &attempt](const User &u) { res = (u.password == xxHashStringGen{}(attempt)); });
|
||||
users.if_contains(name.data(), [&res, &attempt](const User &u) { res = (u.password == xxHashStringGen{}(attempt)); });
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ bool Bank::AdminVerifyAccount(std::string_view name) noexcept
|
|||
return (name == admin_account);
|
||||
}
|
||||
|
||||
BankResponse Bank::AddUser(const std::string &name, std::string &&init_pass) noexcept
|
||||
BankResponse Bank::AddUser(std::string &&name, std::string &&init_pass) noexcept
|
||||
{
|
||||
if (!ValidUsrname(name))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "transaction.h"
|
||||
|
||||
Transaction::Transaction() = default;
|
||||
Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount, time_t time_val) : from(from_str), to(to_str), amount(amount), time(time_val) {}
|
||||
Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount) : from(from_str), to(to_str), amount(amount) { time = std::time(NULL); }
|
||||
Transaction::Transaction(std::string &&from_str, std::string &&to_str, uint32_t amount, time_t time_val) : from(from_str), to(to_str), amount(amount), time(time_val) {}
|
||||
Transaction::Transaction(std::string &&from_str, std::string &&to_str, uint32_t amount) : from(from_str), to(to_str), amount(amount) { time = std::time(NULL); }
|
||||
Loading…
Reference in a new issue