From b297426c9670fa83a12096f9db5666c15e1bb806 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 27 Apr 2017 12:25:13 -0700 Subject: [PATCH] Add -stopatheight for benchmarking --- 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 f06c9e11000..64f571f2842 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -436,6 +436,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 6c60be45a1a..8613241d681 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 c0f9b6d513a..24ebf238df8 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(); }