[Qt] hide bump context menu action if tx already has been bumped
[bitcoinplatinum.git] / src / chainparamsbase.cpp
blob43c9a13c5468b8e01e1f25f5d9b91d6aa8d8a392
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #include "chainparamsbase.h"
8 #include "tinyformat.h"
9 #include "util.h"
11 #include <assert.h>
13 const std::string CBaseChainParams::MAIN = "main";
14 const std::string CBaseChainParams::TESTNET = "test";
15 const std::string CBaseChainParams::REGTEST = "regtest";
17 void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp)
19 strUsage += HelpMessageGroup(_("Chain selection options:"));
20 strUsage += HelpMessageOpt("-testnet", _("Use the test chain"));
21 if (debugHelp) {
22 strUsage += HelpMessageOpt("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
23 "This is intended for regression testing tools and app development.");
27 /**
28 * Main network
30 class CBaseMainParams : public CBaseChainParams
32 public:
33 CBaseMainParams()
35 nRPCPort = 8332;
39 /**
40 * Testnet (v3)
42 class CBaseTestNetParams : public CBaseChainParams
44 public:
45 CBaseTestNetParams()
47 nRPCPort = 18332;
48 strDataDir = "testnet3";
53 * Regression test
55 class CBaseRegTestParams : public CBaseChainParams
57 public:
58 CBaseRegTestParams()
60 nRPCPort = 18332;
61 strDataDir = "regtest";
65 static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
67 const CBaseChainParams& BaseParams()
69 assert(globalChainBaseParams);
70 return *globalChainBaseParams;
73 std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
75 if (chain == CBaseChainParams::MAIN)
76 return std::unique_ptr<CBaseChainParams>(new CBaseMainParams());
77 else if (chain == CBaseChainParams::TESTNET)
78 return std::unique_ptr<CBaseChainParams>(new CBaseTestNetParams());
79 else if (chain == CBaseChainParams::REGTEST)
80 return std::unique_ptr<CBaseChainParams>(new CBaseRegTestParams());
81 else
82 throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
85 void SelectBaseParams(const std::string& chain)
87 globalChainBaseParams = CreateBaseChainParams(chain);
90 std::string ChainNameFromCommandLine()
92 bool fRegTest = GetBoolArg("-regtest", false);
93 bool fTestNet = GetBoolArg("-testnet", false);
95 if (fTestNet && fRegTest)
96 throw std::runtime_error("Invalid combination of -regtest and -testnet.");
97 if (fRegTest)
98 return CBaseChainParams::REGTEST;
99 if (fTestNet)
100 return CBaseChainParams::TESTNET;
101 return CBaseChainParams::MAIN;