aboutsummaryrefslogtreecommitdiff
path: root/src/chainparamsbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chainparamsbase.cpp')
-rw-r--r--src/chainparamsbase.cpp73
1 files changed, 50 insertions, 23 deletions
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp
index d1e19871c3..e9d63197bd 100644
--- a/src/chainparamsbase.cpp
+++ b/src/chainparamsbase.cpp
@@ -17,9 +17,11 @@ using namespace boost::assign;
// Main network
//
-class CBaseMainParams : public CBaseChainParams {
+class CBaseMainParams : public CBaseChainParams
+{
public:
- CBaseMainParams() {
+ CBaseMainParams()
+ {
networkID = CBaseChainParams::MAIN;
nRPCPort = 8332;
}
@@ -29,9 +31,11 @@ static CBaseMainParams mainParams;
//
// Testnet (v3)
//
-class CBaseTestNetParams : public CBaseMainParams {
+class CBaseTestNetParams : public CBaseMainParams
+{
public:
- CBaseTestNetParams() {
+ CBaseTestNetParams()
+ {
networkID = CBaseChainParams::TESTNET;
nRPCPort = 18332;
strDataDir = "testnet3";
@@ -42,40 +46,62 @@ static CBaseTestNetParams testNetParams;
//
// Regression test
//
-class CBaseRegTestParams : public CBaseTestNetParams {
+class CBaseRegTestParams : public CBaseTestNetParams
+{
public:
- CBaseRegTestParams() {
+ CBaseRegTestParams()
+ {
networkID = CBaseChainParams::REGTEST;
strDataDir = "regtest";
}
};
static CBaseRegTestParams regTestParams;
-static CBaseChainParams *pCurrentBaseParams = 0;
+//
+// Unit test
+//
+class CBaseUnitTestParams : public CBaseMainParams
+{
+public:
+ CBaseUnitTestParams()
+ {
+ networkID = CBaseChainParams::UNITTEST;
+ strDataDir = "unittest";
+ }
+};
+static CBaseUnitTestParams unitTestParams;
+
+static CBaseChainParams* pCurrentBaseParams = 0;
-const CBaseChainParams &BaseParams() {
+const CBaseChainParams& BaseParams()
+{
assert(pCurrentBaseParams);
return *pCurrentBaseParams;
}
-void SelectBaseParams(CBaseChainParams::Network network) {
+void SelectBaseParams(CBaseChainParams::Network network)
+{
switch (network) {
- case CBaseChainParams::MAIN:
- pCurrentBaseParams = &mainParams;
- break;
- case CBaseChainParams::TESTNET:
- pCurrentBaseParams = &testNetParams;
- break;
- case CBaseChainParams::REGTEST:
- pCurrentBaseParams = &regTestParams;
- break;
- default:
- assert(false && "Unimplemented network");
- return;
+ case CBaseChainParams::MAIN:
+ pCurrentBaseParams = &mainParams;
+ break;
+ case CBaseChainParams::TESTNET:
+ pCurrentBaseParams = &testNetParams;
+ break;
+ case CBaseChainParams::REGTEST:
+ pCurrentBaseParams = &regTestParams;
+ break;
+ case CBaseChainParams::UNITTEST:
+ pCurrentBaseParams = &unitTestParams;
+ break;
+ default:
+ assert(false && "Unimplemented network");
+ return;
}
}
-bool SelectBaseParamsFromCommandLine() {
+bool SelectBaseParamsFromCommandLine()
+{
bool fRegTest = GetBoolArg("-regtest", false);
bool fTestNet = GetBoolArg("-testnet", false);
@@ -93,6 +119,7 @@ bool SelectBaseParamsFromCommandLine() {
return true;
}
-bool AreBaseParamsConfigured() {
+bool AreBaseParamsConfigured()
+{
return pCurrentBaseParams != NULL;
}