|
|
@ -842,20 +842,22 @@ bool CAddrDB::Read(CAddrMan& addr) |
|
|
|
if (hashIn != hashTmp) |
|
|
|
if (hashIn != hashTmp) |
|
|
|
return error("CAddrman::Read() : checksum mismatch; data corrupted"); |
|
|
|
return error("CAddrman::Read() : checksum mismatch; data corrupted"); |
|
|
|
|
|
|
|
|
|
|
|
// de-serialize address data
|
|
|
|
|
|
|
|
unsigned char pchMsgTmp[4]; |
|
|
|
unsigned char pchMsgTmp[4]; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
// de-serialize file header (pchMessageStart magic number) and
|
|
|
|
ssPeers >> FLATDATA(pchMsgTmp); |
|
|
|
ssPeers >> FLATDATA(pchMsgTmp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify the network matches ours
|
|
|
|
|
|
|
|
if (memcmp(pchMsgTmp, pchMessageStart, sizeof(pchMsgTmp))) |
|
|
|
|
|
|
|
return error("CAddrman::Read() : invalid network magic number"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// de-serialize address data into one CAddrMan object
|
|
|
|
ssPeers >> addr; |
|
|
|
ssPeers >> addr; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (std::exception &e) { |
|
|
|
catch (std::exception &e) { |
|
|
|
return error("CAddrman::Read() : I/O error or stream data corrupted"); |
|
|
|
return error("CAddrman::Read() : I/O error or stream data corrupted"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// finally, verify the network matches ours
|
|
|
|
|
|
|
|
if (memcmp(pchMsgTmp, pchMessageStart, sizeof(pchMsgTmp))) |
|
|
|
|
|
|
|
return error("CAddrman::Read() : invalid network magic number"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|