mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-23 15:22:46 +02:00
Handle rename failure in DumpMempool(...) by using RenameOver(...) return value
This commit is contained in:
parent
e2ff5e7b35
commit
9429a398e2
@ -5110,7 +5110,9 @@ bool DumpMempool(const CTxMemPool& pool)
|
|||||||
if (!FileCommit(file.Get()))
|
if (!FileCommit(file.Get()))
|
||||||
throw std::runtime_error("FileCommit failed");
|
throw std::runtime_error("FileCommit failed");
|
||||||
file.fclose();
|
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();
|
int64_t last = GetTimeMicros();
|
||||||
LogPrintf("Dumped mempool: %gs to copy, %gs to dump\n", (mid-start)*MICRO, (last-mid)*MICRO);
|
LogPrintf("Dumped mempool: %gs to copy, %gs to dump\n", (mid-start)*MICRO, (last-mid)*MICRO);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user