aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chainparams.cpp')
-rw-r--r--src/chainparams.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 179db5a818..31c67715c8 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -115,6 +115,7 @@ public:
fAllowMinDifficultyBlocks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
+ fSkipProofOfWorkCheck = false;
}
};
static CMainParams mainParams;
@@ -214,8 +215,46 @@ public:
};
static CRegTestParams regTestParams;
+//
+// Unit test
+//
+class CUnitTestParams : public CMainParams, public CModifiableParams {
+public:
+ CUnitTestParams() {
+ networkID = CBaseChainParams::UNITTEST;
+ strNetworkID = "unittest";
+ nDefaultPort = 18445;
+ vFixedSeeds.clear();
+ vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
+
+ fRequireRPCPassword = false;
+ fMiningRequiresPeers = false;
+ fDefaultCheckMemPool = true;
+ fAllowMinDifficultyBlocks = false;
+ fMineBlocksOnDemand = true;
+ }
+public:
+ // Published setters to allow changing values in unit test cases
+ virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; }
+ virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; }
+ virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; }
+ virtual void setToCheckBlockUpgradeMajority(int anToCheckBlockUpgradeMajority) { nToCheckBlockUpgradeMajority=anToCheckBlockUpgradeMajority; }
+ virtual void setDefaultCheckMemPool(bool afDefaultCheckMemPool) { fDefaultCheckMemPool=afDefaultCheckMemPool; }
+ virtual void setAllowMinDifficultyBlocks(bool afAllowMinDifficultyBlocks) { fAllowMinDifficultyBlocks=afAllowMinDifficultyBlocks; }
+ virtual void setSkipProofOfWorkCheck(bool afSkipProofOfWorkCheck) { fSkipProofOfWorkCheck = afSkipProofOfWorkCheck; }
+};
+static CUnitTestParams unitTestParams;
+
+
static CChainParams *pCurrentParams = 0;
+CModifiableParams *ModifiableParams()
+{
+ assert(pCurrentParams);
+ assert(pCurrentParams==&unitTestParams);
+ return (CModifiableParams*)&unitTestParams;
+}
+
const CChainParams &Params() {
assert(pCurrentParams);
return *pCurrentParams;
@@ -229,6 +268,8 @@ CChainParams &Params(CBaseChainParams::Network network) {
return testNetParams;
case CBaseChainParams::REGTEST:
return regTestParams;
+ case CBaseChainParams::UNITTEST:
+ return unitTestParams;
default:
assert(false && "Unimplemented network");
return mainParams;