Match network id to regtest

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
This commit is contained in:
Anthony Fieroni 2019-09-10 14:53:58 +03:00
parent da86c108e7
commit e44cf950ce
7 changed files with 25 additions and 24 deletions

View file

@ -112,7 +112,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
class CMainParams : public CChainParams {
public:
CMainParams() {
strNetworkID = "lbrycrd";
strNetworkID = CBaseChainParams::MAIN;
consensus.nSubsidyLevelInterval = 1<<5;
consensus.nMajorityEnforceBlockUpgrade = 750;
consensus.nMajorityRejectBlockOutdated = 950;
@ -223,7 +223,7 @@ public:
class CTestNetParams : public CChainParams {
public:
CTestNetParams() {
strNetworkID = "lbrycrdtest";
strNetworkID = CBaseChainParams::TESTNET;
consensus.nSubsidyLevelInterval = 1 << 5;
consensus.nMajorityEnforceBlockUpgrade = 51;
consensus.nMajorityRejectBlockOutdated = 75;
@ -325,7 +325,7 @@ public:
class CRegTestParams : public CChainParams {
public:
explicit CRegTestParams(const ArgsManager& args) {
strNetworkID = "lbrycrdreg";
strNetworkID = CBaseChainParams::REGTEST;
consensus.nSubsidyLevelInterval = 1 << 5;
consensus.BIP16Exception = uint256();
consensus.BIP34Height = 1000; // BIP34 is needed for validation_block_tests

View file

@ -13,7 +13,7 @@
const std::string CBaseChainParams::MAIN = "lbrycrd";
const std::string CBaseChainParams::TESTNET = "lbrycrdtest";
const std::string CBaseChainParams::REGTEST = "regtest";
const std::string CBaseChainParams::REGTEST = "lbrycrdreg";
void SetupChainParamsBaseOptions()
{

View file

@ -18,8 +18,8 @@ static const struct {
const int iconColorSaturationReduction;
} network_styles[] = {
{"lbrycrd", QAPP_APP_NAME_DEFAULT, 0, 0},
{"lbrycrdtest", QAPP_APP_NAME_TESTNET, 70, 30, QT_TRANSLATE_NOOP("SplashScreen")},
{"regtest", QAPP_APP_NAME_REGTEST, 160, 30}
{"lbrycrdtest", QAPP_APP_NAME_TESTNET, 70, 30},
{"lbrycrdreg", QAPP_APP_NAME_REGTEST, 160, 30}
};
static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles);

View file

@ -134,11 +134,11 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char*
PaymentRequestPlus request;
if (readPaymentRequestFromFile(arg, request))
{
if (request.getDetails().network() == "lbrycrd")
if (request.getDetails().network() == CBaseChainParams::MAIN)
{
node.selectParams(CBaseChainParams::MAIN);
}
else if (request.getDetails().network() == "lbrycrdtest")
else if (request.getDetails().network() == CBaseChainParams::TESTNET)
{
node.selectParams(CBaseChainParams::TESTNET);
}

View file

@ -443,7 +443,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (Params().NetworkIDString() != "lbrycrdreg") // who should own this constant?
if (Params().NetworkIDString() != CBaseChainParams::REGTEST) // who should own this constant?
{
if (!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");

View file

@ -28,7 +28,7 @@
"76a91453c0307d6851aa0ce7825ba883c6bd9ad242b48688ac",
{
"isPrivkey": false,
"chain": "regtest"
"chain": "lbrycrdreg"
}
],
[
@ -72,7 +72,7 @@
{
"isCompressed": false,
"isPrivkey": true,
"chain": "regtest"
"chain": "lbrycrdreg"
}
],
[
@ -90,7 +90,7 @@
{
"isCompressed": true,
"isPrivkey": true,
"chain": "regtest"
"chain": "lbrycrdreg"
}
],
[
@ -294,7 +294,7 @@
{
"isCompressed": false,
"isPrivkey": true,
"chain": "regtest"
"chain": "lbrycrdreg"
}
],
[
@ -481,7 +481,7 @@
"001428e40f9a66993a8d50b2604af71b17e1606842d8",
{
"isPrivkey": false,
"chain": "regtest",
"chain": "lbrycrdreg",
"tryCaseFlip": true
}
]

View file

@ -4,6 +4,7 @@
#include <util/system.h>
#include <chainparamsbase.h>
#include <clientversion.h>
#include <sync.h>
#include <test/setup_common.h>
@ -562,27 +563,27 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
std::string error;
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrd");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::MAIN);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "regtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::REGTEST);
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_test_no_reg, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
test_args.ReadConfigString(testnetconf);
@ -590,7 +591,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_test_no_reg, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
test_args.ReadConfigString(testnetconf);
@ -602,11 +603,11 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
test_args.ReadConfigString(testnetconf);
@ -614,7 +615,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_test_no_reg, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest");
BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
test_args.ReadConfigString(testnetconf);