Skip to content

Commit 8d2edc4

Browse files
laanwjcodablock
authored andcommitted
Merge bitcoin#9813: Read/write mempool.dat as a binary.
171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
1 parent 199b07a commit 8d2edc4

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
@@ -4501,7 +4501,7 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
45014501
bool LoadMempool(void)
45024502
{
45034503
int64_t nExpiryTimeout = GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
4504-
FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "r");
4504+
FILE* filestr = fopen((GetDataDir() / "mempool.dat").string().c_str(), "rb");
45054505
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
45064506
if (file.IsNull()) {
45074507
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n");
@@ -4582,7 +4582,7 @@ void DumpMempool(void)
45824582
int64_t mid = GetTimeMicros();
45834583

45844584
try {
4585-
FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "w");
4585+
FILE* filestr = fopen((GetDataDir() / "mempool.dat.new").string().c_str(), "wb");
45864586
if (!filestr) {
45874587
return;
45884588
}

0 commit comments

Comments
 (0)