Merge #9813: Read/write mempool.dat as a binary.

171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
This commit is contained in:
Wladimir J. van der Laan 2017-02-21 09:50:37 +01:00
commit 7d46b3ea8d
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -4180,7 +4180,7 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
bool LoadMempool(void) bool LoadMempool(void)
{ {
int64_t nExpiryTimeout = GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60; int64_t nExpiryTimeout = GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "r"); FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "rb");
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION); CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
if (file.IsNull()) { if (file.IsNull()) {
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n"); LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n");
@ -4261,7 +4261,7 @@ void DumpMempool(void)
int64_t mid = GetTimeMicros(); int64_t mid = GetTimeMicros();
try { try {
FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "w"); FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "wb");
if (!filestr) { if (!filestr) {
return; return;
} }