Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the documentation of this file. 19 template <
typename Stream,
typename Data>
20 bool SerializeDB(Stream& stream,
const Data& data)
27 stream << hasher.GetHash();
28 }
catch (
const std::exception& e) {
29 return error(
"%s: Serialize or I/O error - %s", __func__, e.what());
35 template <
typename Data>
36 bool SerializeFileDB(
const std::string&
prefix,
const fs::path& path,
const Data& data)
39 unsigned short randv = 0;
48 return error(
"%s: Failed to open file %s", __func__, pathTmp.string());
51 if (!SerializeDB(
fileout, data))
return false;
57 return error(
"%s: Rename-into-place failed", __func__);
62 template <
typename Stream,
typename Data>
63 bool DeserializeDB(Stream& stream, Data& data,
bool fCheckSum =
true)
68 unsigned char pchMsgTmp[4];
71 if (memcmp(pchMsgTmp,
Params().MessageStart(),
sizeof(pchMsgTmp)))
72 return error(
"%s: Invalid network magic number", __func__);
81 if (hashTmp != verifier.GetHash()) {
82 return error(
"%s: Checksum mismatch, data corrupted", __func__);
86 catch (
const std::exception& e) {
87 return error(
"%s: Deserialize or I/O error - %s", __func__, e.what());
93 template <
typename Data>
94 bool DeserializeFileDB(
const fs::path& path, Data& data)
100 return error(
"%s: Failed to open file %s", __func__, path.string());
102 return DeserializeDB(filein, data);
114 return SerializeFileDB(
"banlist",
pathBanlist, banSet);
129 return SerializeFileDB(
"peers",
pathAddr, addr);
134 return DeserializeFileDB(
pathAddr, addr);
139 bool ret = DeserializeDB(ssPeers, addr,
false);
FILE * fopen(const fs::path &p, const char *mode)
void FileCommit(FILE *file)
static FILE * fileout
We use boost::call_once() to make sure mutexDebugLog and vMsgsBeforeOpenLog are initialized in a thre...
Double ended buffer combining vector and stream-like interfaces.
Reads data from an underlying stream, while hashing the read data.
Stochastical (IP) address manager.
std::map< CSubNet, CBanEntry > banmap_t
bool Write(const CAddrMan &addr)
bool RenameOver(fs::path src, fs::path dest)
bool Write(const banmap_t &banSet)
bool Read(banmap_t &banSet)
const CChainParams & Params()
Return the currently selected parameters.
void GetRandBytes(unsigned char *buf, int num)
Functions to gather random data via the OpenSSL PRNG.
bool error(const char *fmt, const Args &... args)
A writer stream (for serialization) that computes a 256-bit hash.
const fs::path & GetDataDir(bool fNetSpecific)
static const int CLIENT_VERSION
dashd-res.rc includes this file, but it cannot cope with real c++ code.
bool Read(CAddrMan &addr)
Non-refcounted RAII wrapper for FILE*.