Browse Source

Control mempool persistence using a command line parameter.

Mempool persistence was added in
3f78562df5, 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.
0.15
John Newbery 7 years ago
parent
commit
91c91e140a
  1. 10
      src/init.cpp
  2. 3
      src/validation.h

10
src/init.cpp

@ -206,8 +206,9 @@ void Shutdown() @@ -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) @@ -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) @@ -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

3
src/validation.h

@ -131,7 +131,8 @@ static const bool DEFAULT_PERMIT_BAREMULTISIG = true; @@ -131,7 +131,8 @@ static const bool DEFAULT_PERMIT_BAREMULTISIG = true;
static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
static const bool DEFAULT_TXINDEX = false;
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
/** Default for -persistmempool */
static const bool DEFAULT_PERSIST_MEMPOOL = true;
/** Default for -mempoolreplacement */
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
/** Default for using fee filter */

Loading…
Cancel
Save