diff options
author | Mike Hearn <hearn@google.com> | 2013-05-07 15:16:25 +0200 |
---|---|---|
committer | Mike Hearn <hearn@google.com> | 2013-06-19 16:28:52 +0200 |
commit | 0e4b31755534fac4ea6c20a60f719e3694252220 (patch) | |
tree | 80f576f67c855485e5d82007b98a45536bbf2f9a /src/init.cpp | |
parent | 70e7fba06da36218688a4cae4a5d12332c714247 (diff) |
Introduce a CChainParameters singleton class and regtest mode.
The new class is accessed via the Params() method and holds
most things that vary between main, test and regtest networks.
The regtest mode has two purposes, one is to run the
bitcoind/bitcoinj comparison tool which compares two separate
implementations of the Bitcoin protocol looking for divergence.
The other is that when run, you get a local node which can mine
a single block instantly, which is highly convenient for testing
apps during development as there's no need to wait 10 minutes for
a block on the testnet.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp index fe74cd6963..4e599048ac 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -6,6 +6,7 @@ #include "init.h" #include "main.h" #include "core.h" +#include "chainparams.h" #include "txdb.h" #include "walletdb.h" #include "bitcoinrpc.h" @@ -13,6 +14,7 @@ #include "util.h" #include "ui_interface.h" #include "checkpoints.h" +#include "chainparams.h" #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> @@ -210,6 +212,8 @@ std::string HelpMessage() strUsage += " -logtimestamps " + _("Prepend debug output with timestamp") + "\n"; strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n"; strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; + strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be " + "solved instantly. This is intended for regression testing tools and app development.") + "\n"; #ifdef WIN32 strUsage += " -printtodebugger " + _("Send trace/debug info to debugger") + "\n"; #endif @@ -366,8 +370,10 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 2: parameter interactions - fTestNet = GetBoolArg("-testnet", false); Checkpoints::fEnabled = GetBoolArg("-checkpoints", true); + if (!SelectParamsFromCommandLine()) { + return InitError("Invalid combination of -testnet and -regtest."); + } if (mapArgs.count("-bind")) { // when specifying an explicit binding address, you want to listen on it @@ -572,7 +578,7 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 6: network initialization RegisterNodeSignals(GetNodeSignals()); - + int nSocksVersion = GetArg("-socks", 5); if (nSocksVersion != 4 && nSocksVersion != 5) return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion)); @@ -937,7 +943,6 @@ bool AppInit2(boost::thread_group& threadGroup) nStart = GetTimeMillis(); { - CAddrDB::SetMessageStart(pchMessageStart); CAddrDB adb; if (!adb.Read(addrman)) printf("Invalid or missing peers.dat; recreating\n"); |