aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-09 17:12:25 -0500
committerJohn Newbery <john@johnnewbery.com>2017-03-22 11:17:17 -0400
commit91c91e140aeea291d95fb1028e7e4aa1e4381939 (patch)
tree8dc9da2cfa26a6c594433fbc9bee66439fa57fdf /src/init.cpp
parent02d64bd929c9663ba38e96721c6dbd89972d043d (diff)
downloadbitcoin-91c91e140aeea291d95fb1028e7e4aa1e4381939.tar.xz
Control mempool persistence using a command line parameter.
Mempool persistence was added in 3f78562df5e86a2a0a21812047fc3a7db8cee988, and is always on. This commit introduces a command-line parameter -persistmempool, which defaults to true. When set to false: - mempool.dat is not loaded when the node starts. - mempool.dat is not written when the node stops.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 246d5f340a..678130a04e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -206,8 +206,9 @@ void Shutdown()
StopTorControl();
UnregisterNodeSignals(GetNodeSignals());
- if (fDumpMempoolLater)
+ if (fDumpMempoolLater && GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
DumpMempool();
+ }
if (fFeeEstimatesInitialized)
{
@@ -339,6 +340,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-maxorphantx=<n>", strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
strUsage += HelpMessageOpt("-maxmempool=<n>", strprintf(_("Keep the transaction memory pool below <n> megabytes (default: %u)"), DEFAULT_MAX_MEMPOOL_SIZE));
strUsage += HelpMessageOpt("-mempoolexpiry=<n>", strprintf(_("Do not keep transactions in the mempool longer than <n> hours (default: %u)"), DEFAULT_MEMPOOL_EXPIRY));
+ strUsage += HelpMessageOpt("-persistmempool", strprintf(_("Whether to save the mempool on shutdown and load on restart (default: %u)"), DEFAULT_PERSIST_MEMPOOL));
strUsage += HelpMessageOpt("-blockreconstructionextratxn=<n>", strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"), DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN));
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
-GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
@@ -666,8 +668,10 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
StartShutdown();
}
} // End scope of CImportingNow
- LoadMempool();
- fDumpMempoolLater = !fRequestShutdown;
+ if (GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
+ LoadMempool();
+ fDumpMempoolLater = !fRequestShutdown;
+ }
}
/** Sanity checks