diff options
Diffstat (limited to 'src/db.cpp')
-rw-r--r-- | src/db.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/db.cpp b/src/db.cpp index 1f53917602..93f3f5d8c4 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "chainparams.h" #include "db.h" #include "util.h" #include "hash.h" @@ -488,8 +489,6 @@ void CDBEnv::Flush(bool fShutdown) // CAddrDB // -unsigned char CAddrDB::pchMessageStart[4] = { 0x00, 0x00, 0x00, 0x00 }; - CAddrDB::CAddrDB() { pathAddr = GetDataDir() / "peers.dat"; @@ -504,7 +503,7 @@ bool CAddrDB::Write(const CAddrMan& addr) // serialize addresses, checksum data up to that point, then append csum CDataStream ssPeers(SER_DISK, CLIENT_VERSION); - ssPeers << FLATDATA(CAddrDB::pchMessageStart); + ssPeers << FLATDATA(Params().MessageStart()); ssPeers << addr; uint256 hash = Hash(ssPeers.begin(), ssPeers.end()); ssPeers << hash; @@ -569,11 +568,11 @@ bool CAddrDB::Read(CAddrMan& addr) unsigned char pchMsgTmp[4]; try { - // de-serialize file header (CAddrDB::pchMessageStart magic number) and + // de-serialize file header (network specific magic number) and .. ssPeers >> FLATDATA(pchMsgTmp); - // verify the network matches ours - if (memcmp(pchMsgTmp, CAddrDB::pchMessageStart, sizeof(pchMsgTmp))) + // ... verify the network matches ours + if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp))) return error("CAddrman::Read() : invalid network magic number"); // de-serialize address data into one CAddrMan object |