Match network id to regtest #315

Merged
bvbfan merged 1 commit from lbrycrdreg into master 2019-09-10 19:54:05 +02:00
7 changed files with 24 additions and 23 deletions

View file

@ -123,7 +123,7 @@ void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64
class CMainParams : public CChainParams { class CMainParams : public CChainParams {
public: public:
CMainParams() { CMainParams() {
strNetworkID = "lbrycrd"; strNetworkID = CBaseChainParams::MAIN;
consensus.nSubsidyLevelInterval = 1<<5; consensus.nSubsidyLevelInterval = 1<<5;
consensus.nMajorityEnforceBlockUpgrade = 750; consensus.nMajorityEnforceBlockUpgrade = 750;
consensus.nMajorityRejectBlockOutdated = 950; consensus.nMajorityRejectBlockOutdated = 950;
@ -241,7 +241,7 @@ public:
class CTestNetParams : public CChainParams { class CTestNetParams : public CChainParams {
public: public:
CTestNetParams() { CTestNetParams() {
strNetworkID = "lbrycrdtest"; strNetworkID = CBaseChainParams::TESTNET;
consensus.nSubsidyLevelInterval = 1 << 5; consensus.nSubsidyLevelInterval = 1 << 5;
consensus.nMajorityEnforceBlockUpgrade = 51; consensus.nMajorityEnforceBlockUpgrade = 51;
consensus.nMajorityRejectBlockOutdated = 75; consensus.nMajorityRejectBlockOutdated = 75;
@ -351,7 +351,7 @@ public:
class CRegTestParams : public CChainParams { class CRegTestParams : public CChainParams {
public: public:
CRegTestParams() { CRegTestParams() {
strNetworkID = "lbrycrdreg"; strNetworkID = CBaseChainParams::REGTEST;
consensus.nSubsidyLevelInterval = 1 << 5; consensus.nSubsidyLevelInterval = 1 << 5;
consensus.BIP16Exception = uint256(); consensus.BIP16Exception = uint256();
consensus.BIP34Height = 1000; // BIP34 is needed for validation_block_tests 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::MAIN = "lbrycrd";
const std::string CBaseChainParams::TESTNET = "lbrycrdtest"; const std::string CBaseChainParams::TESTNET = "lbrycrdtest";
const std::string CBaseChainParams::REGTEST = "regtest"; const std::string CBaseChainParams::REGTEST = "lbrycrdreg";
void SetupChainParamsBaseOptions() void SetupChainParamsBaseOptions()
{ {

View file

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

View file

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

View file

@ -451,7 +451,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
if (strMode != "template") if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); 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) if (!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");

View file

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

View file

@ -4,6 +4,7 @@
#include <util.h> #include <util.h>
#include <chainparamsbase.h>
#include <clientversion.h> #include <clientversion.h>
#include <primitives/transaction.h> #include <primitives/transaction.h>
#include <sync.h> #include <sync.h>
@ -558,27 +559,27 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
std::string error; std::string error;
test_args.ParseParameters(0, (char**)argv_testnet, error); test_args.ParseParameters(0, (char**)argv_testnet, error);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrd"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::MAIN);
test_args.ParseParameters(2, (char**)argv_testnet, error); test_args.ParseParameters(2, (char**)argv_testnet, error);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(2, (char**)argv_regtest, error); test_args.ParseParameters(2, (char**)argv_regtest, error);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "regtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::REGTEST);
test_args.ParseParameters(3, (char**)argv_test_no_reg, error); 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);
test_args.ParseParameters(3, (char**)argv_both, error); test_args.ParseParameters(3, (char**)argv_both, error);
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error); BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
test_args.ParseParameters(0, (char**)argv_testnet, error); test_args.ParseParameters(0, (char**)argv_testnet, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(2, (char**)argv_testnet, error); test_args.ParseParameters(2, (char**)argv_testnet, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(2, (char**)argv_regtest, error); test_args.ParseParameters(2, (char**)argv_regtest, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
@ -586,7 +587,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
test_args.ParseParameters(3, (char**)argv_test_no_reg, error); test_args.ParseParameters(3, (char**)argv_test_no_reg, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(3, (char**)argv_both, error); test_args.ParseParameters(3, (char**)argv_both, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
@ -598,11 +599,11 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
test_args.ParseParameters(0, (char**)argv_testnet, error); test_args.ParseParameters(0, (char**)argv_testnet, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(2, (char**)argv_testnet, error); test_args.ParseParameters(2, (char**)argv_testnet, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(2, (char**)argv_regtest, error); test_args.ParseParameters(2, (char**)argv_regtest, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
@ -610,7 +611,7 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
test_args.ParseParameters(2, (char**)argv_test_no_reg, error); test_args.ParseParameters(2, (char**)argv_test_no_reg, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET);
test_args.ParseParameters(3, (char**)argv_both, error); test_args.ParseParameters(3, (char**)argv_both, error);
test_args.ReadConfigString(testnetconf); test_args.ReadConfigString(testnetconf);