diff --git a/include/log.hpp b/include/log.hpp index d36f795..e3d7bdb 100644 --- a/include/log.hpp +++ b/include/log.hpp @@ -9,17 +9,18 @@ struct Log std::vector data; void AddTrans(Transaction &&t) { - if (data.size() == max_log_size) + if (data.size() == max_log_size) // If we hit the max size { - for (auto i = data.size() - 1; i > 0; i--) + for (auto i = data.size() - 1; i > 0; i--) // Make room at the back { data[i - 1] == std::move(data[i]) } } - else if (data.size() == data.capacity()) { - data.reserve(data.capacity() + pre_alloc) + else if (data.size() == data.capacity()) // If we haven't hit the max but hit capacity + { + data.reserve(data.capacity() + pre_alloc) // Reserve more memory } - data[data.size() - 1] = std::move(t) + data[data.size() - 1] = std::move(t) // In any case, place new at the back } Json::Value Serialize() const {