Browse Source

Add -stopatheight for benchmarking

pull/1/head
Pieter Wuille 5 years ago
parent
commit
b297426c96
  1. 2
      src/init.cpp
  2. 3
      src/validation.cpp
  3. 3
      src/validation.h

2
src/init.cpp

@ -436,6 +436,8 @@ std::string HelpMessage(HelpMessageMode mode) @@ -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));

3
src/validation.cpp

@ -2537,6 +2537,9 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, @@ -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;
}

3
src/validation.h

@ -145,6 +145,9 @@ static const int MAX_UNCONNECTING_HEADERS = 10; @@ -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(); }

Loading…
Cancel
Save