|
|
@ -16,6 +16,7 @@ |
|
|
|
#endif |
|
|
|
#include "checkpoints.h" |
|
|
|
#include "compat/sanity.h" |
|
|
|
#include "consensus/upgrades.h" |
|
|
|
#include "consensus/validation.h" |
|
|
|
#include "httpserver.h" |
|
|
|
#include "httprpc.h" |
|
|
@ -44,8 +45,10 @@ |
|
|
|
#include <signal.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
#include <boost/algorithm/string/classification.hpp> |
|
|
|
#include <boost/algorithm/string/predicate.hpp> |
|
|
|
#include <boost/algorithm/string/replace.hpp> |
|
|
|
#include <boost/algorithm/string/split.hpp> |
|
|
|
#include <boost/bind.hpp> |
|
|
|
#include <boost/filesystem.hpp> |
|
|
|
#include <boost/function.hpp> |
|
|
@ -448,6 +451,7 @@ std::string HelpMessage(HelpMessageMode mode) |
|
|
|
strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", "Randomly fuzz 1 of every <n> network messages"); |
|
|
|
strUsage += HelpMessageOpt("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", 1)); |
|
|
|
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", 0)); |
|
|
|
strUsage += HelpMessageOpt("-nuparams=hexBranchId:activationHeight", "Use given activation height for specified network upgrade (regtest-only)"); |
|
|
|
} |
|
|
|
string debugCategories = "addrman, alert, bench, coindb, db, estimatefee, http, libevent, lock, mempool, net, partitioncheck, pow, proxy, prune, " |
|
|
|
"rand, reindex, rpc, selectcoins, tor, zmq, zrpc, zrpcunsafe (implies zrpc)"; // Don't translate these
|
|
|
@ -1035,6 +1039,38 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!mapMultiArgs["-nuparams"].empty()) { |
|
|
|
// Allow overriding network upgrade parameters for testing
|
|
|
|
if (Params().NetworkIDString() != "regtest") { |
|
|
|
return InitError("Network upgrade parameters may only be overridden on regtest."); |
|
|
|
} |
|
|
|
const vector<string>& deployments = mapMultiArgs["-nuparams"]; |
|
|
|
for (auto i : deployments) { |
|
|
|
std::vector<std::string> vDeploymentParams; |
|
|
|
boost::split(vDeploymentParams, i, boost::is_any_of(":")); |
|
|
|
if (vDeploymentParams.size() != 2) { |
|
|
|
return InitError("Network upgrade parameters malformed, expecting hexBranchId:activationHeight"); |
|
|
|
} |
|
|
|
int nActivationHeight; |
|
|
|
if (!ParseInt32(vDeploymentParams[1], &nActivationHeight)) { |
|
|
|
return InitError(strprintf("Invalid nActivationHeight (%s)", vDeploymentParams[1])); |
|
|
|
} |
|
|
|
bool found = false; |
|
|
|
// Exclude Sprout from upgrades
|
|
|
|
for (auto i = Consensus::BASE_SPROUT + 1; i < Consensus::MAX_NETWORK_UPGRADES; ++i) |
|
|
|
{ |
|
|
|
if (vDeploymentParams[0].compare(HexInt(NetworkUpgradeInfo[i].nBranchId)) == 0) { |
|
|
|
UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex(i), nActivationHeight); |
|
|
|
found = true; |
|
|
|
LogPrintf("Setting network upgrade activation parameters for %s to height=%d\n", vDeploymentParams[0], nActivationHeight); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!found) { |
|
|
|
return InitError(strprintf("Invalid network upgrade (%s)", vDeploymentParams[0])); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
|
|
|
|
|
|
|