From 0326e21a80148d27c5690950e8198187733db114 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 1 May 2017 09:16:17 +0200 Subject: [PATCH] Merge #10290: Add -stopatheight for benchmarking b297426 Add -stopatheight for benchmarking (Pieter Wuille) Tree-SHA512: e8a4cca7fc1accd0dcd3a0eda97839fc34c61f25d6302082a8d6ecf9a0291b4abacbde16a0ecba7bdd2a56dd0c8d4d54300ad3b3478386da21dd7697acce381c --- src/init.cpp | 2 ++ src/validation.cpp | 3 +++ src/validation.h | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index ec056099e..05b511090 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -557,6 +557,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-dropmessagestest=", "Randomly drop 1 of every network messages"); strUsage += HelpMessageOpt("-fuzzmessagestest=", "Randomly fuzz 1 of every 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=", strprintf("Do not accept transactions if number of in-mempool ancestors is or more (default: %u)", DEFAULT_ANCESTOR_LIMIT)); strUsage += HelpMessageOpt("-limitancestorsize=", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT)); strUsage += HelpMessageOpt("-limitdescendantcount=", strprintf("Do not accept transactions if any ancestor would have or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT)); diff --git a/src/validation.cpp b/src/validation.cpp index b3ef4865a..a3ed30ab8 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2964,6 +2964,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 a6a2b851b..9384681b2 100644 --- a/src/validation.h +++ b/src/validation.h @@ -146,6 +146,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(); }