aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-11-27 12:41:07 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-11-27 12:41:07 +0000
commit9429a398e291a1b5edcfc657b94fcaf52cd1d8f9 (patch)
treefd0b76dfff5df9b1be81d0738988e2a79eca5fc1
parente2ff5e7b35d71195278d2a2ed9485f141de33d7a (diff)
Handle rename failure in DumpMempool(...) by using RenameOver(...) return value
-rw-r--r--src/validation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 71402ef263..9197daec80 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5110,7 +5110,9 @@ bool DumpMempool(const CTxMemPool& pool)
if (!FileCommit(file.Get()))
throw std::runtime_error("FileCommit failed");
file.fclose();
- RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat");
+ if (!RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat")) {
+ throw std::runtime_error("Rename failed");
+ }
int64_t last = GetTimeMicros();
LogPrintf("Dumped mempool: %gs to copy, %gs to dump\n", (mid-start)*MICRO, (last-mid)*MICRO);
} catch (const std::exception& e) {