Skip to content

Commit 171fc91

Browse files
committed
Read/write mempool.dat as a binary.
mempool.dat is a binary file and thus it should be read/written as such. Fixes #9810.
1 parent 7639d38 commit 171fc91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,7 +4180,7 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
41804180
bool LoadMempool(void)
41814181
{
41824182
int64_t nExpiryTimeout = GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
4183-
FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "r");
4183+
FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "rb");
41844184
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
41854185
if (file.IsNull()) {
41864186
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n");
@@ -4261,7 +4261,7 @@ void DumpMempool(void)
42614261
int64_t mid = GetTimeMicros();
42624262

42634263
try {
4264-
FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "w");
4264+
FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "wb");
42654265
if (!filestr) {
42664266
return;
42674267
}

0 commit comments

Comments
 (0)