| 18 | |
| 19 | template <typename Stream, typename Data> |
| 20 | bool SerializeDB(Stream& stream, const Data& data) |
| 21 | { |
| 22 | // Write and commit header, data |
| 23 | try { |
| 24 | CHashWriter hasher(SER_DISK, CLIENT_VERSION); |
| 25 | stream << Params().MessageStart() << data; |
| 26 | hasher << Params().MessageStart() << data; |
| 27 | stream << hasher.GetHash(); |
| 28 | } catch (const std::exception& e) { |
| 29 | return error("%s: Serialize or I/O error - %s", __func__, e.what()); |
| 30 | } |
| 31 | |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | template <typename Data> |
| 36 | bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data& data) |
no test coverage detected