diff --git a/include/transactions.hpp b/include/transactions.hpp index fe519f9..996c3de 100644 --- a/include/transactions.hpp +++ b/include/transactions.hpp @@ -2,15 +2,18 @@ #include #include -//42 bytes total struct Transaction { - std::string from = "", to = ""; uint32_t amount = 0; uint64_t time = 0; Transaction() = default; + Transaction(std::string from_str, std::string to_str, uint32_t amount, uint64_t time) : amount(amount), time(time) + { + from = std::move(from_str); + to = std::move(to_str); + } Transaction(std::string from_str, std::string to_str, uint32_t amount) : amount(amount) { using namespace std::chrono; @@ -18,4 +21,4 @@ struct Transaction to = std::move(to_str); time = duration_cast(system_clock::now().time_since_epoch()).count(); } -}; \ No newline at end of file +}; diff --git a/include/user.hpp b/include/user.hpp index 8e3ecd0..f712517 100644 --- a/include/user.hpp +++ b/include/user.hpp @@ -47,7 +47,7 @@ struct User } for (uint32_t i = 0; i < log.end; ++i) { - log.data[i] = std::move(Transaction(log_j[i]["from"].asCString(), log_j[i]["to"].asCString(), log_j[i]["amount"].asUInt())); + log.data[i] = std::move(Transaction(log_j[i]["from"].asCString(), log_j[i]["to"].asCString(), log_j[i]["amount"].asUInt(), log_j[i]["time"].asUInt64())); } } }