aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-05-01 09:16:17 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-05-01 09:17:15 +0200
commit8d6d43e9338ae7315476872cf706d45d237e1841 (patch)
treed77a42c7831be41f93c90c330a3635d194813cdc /src
parent80c3a734298e824f9321c4efdd446086a3baad89 (diff)
parentb297426c9670fa83a12096f9db5666c15e1bb806 (diff)
downloadbitcoin-8d6d43e9338ae7315476872cf706d45d237e1841.tar.xz
Merge #10290: Add -stopatheight for benchmarking
b297426 Add -stopatheight for benchmarking (Pieter Wuille) Tree-SHA512: e8a4cca7fc1accd0dcd3a0eda97839fc34c61f25d6302082a8d6ecf9a0291b4abacbde16a0ecba7bdd2a56dd0c8d4d54300ad3b3478386da21dd7697acce381c
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp2
-rw-r--r--src/validation.cpp3
-rw-r--r--src/validation.h3
3 files changed, 8 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f06c9e1100..64f571f284 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -436,6 +436,8 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages");
strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", "Randomly fuzz 1 of every <n> network messages");
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", DEFAULT_STOPAFTERBLOCKIMPORT));
+ strUsage += HelpMessageOpt("-stopatheight", strprintf("Stop running after reaching the given height in the main chain (default: %u)", DEFAULT_STOPATHEIGHT));
+
strUsage += HelpMessageOpt("-limitancestorcount=<n>", strprintf("Do not accept transactions if number of in-mempool ancestors is <n> or more (default: %u)", DEFAULT_ANCESTOR_LIMIT));
strUsage += HelpMessageOpt("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT));
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
diff --git a/src/validation.cpp b/src/validation.cpp
index 6c60be45a1..8613241d68 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2537,6 +2537,9 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
return false;
}
+ int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
+ if (nStopAtHeight && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
+
return true;
}
diff --git a/src/validation.h b/src/validation.h
index c0f9b6d513..24ebf238df 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -145,6 +145,9 @@ static const int MAX_UNCONNECTING_HEADERS = 10;
static const bool DEFAULT_PEERBLOOMFILTERS = true;
+/** Default for -stopatheight */
+static const int DEFAULT_STOPATHEIGHT = 0;
+
struct BlockHasher
{
size_t operator()(const uint256& hash) const { return hash.GetCheapHash(); }