Skip to content

Commit 756d0fa

Browse files
practicalswiftfurszy
authored andcommitted
Handle rename failure in DumpMempool(...) by using RenameOver(...) return value
1 parent 1423dba commit 756d0fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/validation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4185,7 +4185,9 @@ void DumpMempool(void)
41854185
file << mapDeltas;
41864186
FileCommit(file.Get());
41874187
file.fclose();
4188-
RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat");
4188+
if (!RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat")) {
4189+
throw std::runtime_error("Rename failed");
4190+
}
41894191
int64_t last = GetTimeMicros();
41904192
LogPrintf("Dumped mempool: %gs to copy, %gs to dump\n", (mid-start)*0.000001, (last-mid)*0.000001);
41914193
} catch (const std::exception& e) {

0 commit comments

Comments
 (0)