diff --git a/src/chainparams.cpp b/src/chainparams.cpp index a69f0519f..dec9b612e 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -123,7 +123,7 @@ void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64 class CMainParams : public CChainParams { public: CMainParams() { - strNetworkID = "lbrycrd"; + strNetworkID = CBaseChainParams::MAIN; consensus.nSubsidyLevelInterval = 1<<5; consensus.nMajorityEnforceBlockUpgrade = 750; consensus.nMajorityRejectBlockOutdated = 950; @@ -241,7 +241,7 @@ public: class CTestNetParams : public CChainParams { public: CTestNetParams() { - strNetworkID = "lbrycrdtest"; + strNetworkID = CBaseChainParams::TESTNET; consensus.nSubsidyLevelInterval = 1 << 5; consensus.nMajorityEnforceBlockUpgrade = 51; consensus.nMajorityRejectBlockOutdated = 75; @@ -351,7 +351,7 @@ public: class CRegTestParams : public CChainParams { public: CRegTestParams() { - strNetworkID = "lbrycrdreg"; + strNetworkID = CBaseChainParams::REGTEST; consensus.nSubsidyLevelInterval = 1 << 5; consensus.BIP16Exception = uint256(); consensus.BIP34Height = 1000; // BIP34 is needed for validation_block_tests diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 39defac66..dddd7daaf 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -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() { diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index fdf469b0a..7667a64b8 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -17,7 +17,7 @@ static const struct { } network_styles[] = { {"lbrycrd", QAPP_APP_NAME_DEFAULT, 0, 0, ""}, {"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); diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 35a536b26..824bbcf88 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -228,11 +228,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); } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 6286b90a3..0d1ba67ed 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -451,7 +451,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"); diff --git a/src/script/script.cpp b/src/script/script.cpp index c530dd937..9bdf3ed80 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -133,9 +133,9 @@ const char* GetOpName(opcodetype opcode) case OP_CHECKSEQUENCEVERIFY : return "OP_CHECKSEQUENCEVERIFY"; case OP_NOP4 : return "OP_NOP4"; case OP_NOP5 : return "OP_NOP5"; - case OP_NOP6 : return "OP_CLAIM_NAME"; - case OP_NOP7 : return "OP_SUPPORT_CLAIM"; - case OP_NOP8 : return "OP_UPDATE_CLAIM"; + case OP_NOP6 : return "OP_NOP6"; + case OP_NOP7 : return "OP_NOP7"; + case OP_NOP8 : return "OP_NOP8"; case OP_NOP9 : return "OP_NOP9"; case OP_NOP10 : return "OP_NOP10"; diff --git a/src/test/data/key_io_valid.json b/src/test/data/key_io_valid.json index e5a1193f0..85f6c970d 100644 --- a/src/test/data/key_io_valid.json +++ b/src/test/data/key_io_valid.json @@ -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 } ] diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json index 2c791af4b..0964902db 100644 --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -458,6 +458,9 @@ ["NOP", "CHECKSEQUENCEVERIFY 1", "P2SH,STRICTENC", "OK"], ["NOP", "NOP4 1", "P2SH,STRICTENC", "OK"], ["NOP", "NOP5 1", "P2SH,STRICTENC", "OK"], +["NOP", "NOP6 1", "P2SH,STRICTENC", "OK"], +["NOP", "NOP7 1", "P2SH,STRICTENC", "OK"], +["NOP", "NOP8 1", "P2SH,STRICTENC", "OK"], ["NOP", "NOP9 1", "P2SH,STRICTENC", "OK"], ["NOP", "NOP10 1", "P2SH,STRICTENC", "OK"], @@ -866,8 +869,8 @@ ["2 2 LSHIFT", "8 EQUAL", "P2SH,STRICTENC", "DISABLED_OPCODE", "disabled"], ["2 1 RSHIFT", "1 EQUAL", "P2SH,STRICTENC", "DISABLED_OPCODE", "disabled"], -["1", "NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP9 NOP10 2 EQUAL", "P2SH,STRICTENC", "EVAL_FALSE"], -["'NOP_1_to_10' NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP9 NOP10","'NOP_1_to_11' EQUAL", "P2SH,STRICTENC", "EVAL_FALSE"], +["1", "NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 2 EQUAL", "P2SH,STRICTENC", "EVAL_FALSE"], +["'NOP_1_to_10' NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_11' EQUAL", "P2SH,STRICTENC", "EVAL_FALSE"], ["Ensure 100% coverage of discouraged NOPS"], ["1", "NOP1", "P2SH,DISCOURAGE_UPGRADABLE_NOPS", "DISCOURAGE_UPGRADABLE_NOPS"], @@ -1790,7 +1793,7 @@ "2-of-2 with two identical keys and sigs pushed using OP_DUP" ], [ - "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP9 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", + "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP8 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", "HASH160 0x14 0x215640c2f72f0d16b4eced26762035a42ffed39a EQUAL", "", "OK", @@ -1804,14 +1807,14 @@ "P2PK with non-push scriptSig but with P2SH validation" ], [ - "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP9 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", + "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP8 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", "HASH160 0x14 0x215640c2f72f0d16b4eced26762035a42ffed39a EQUAL", "P2SH", "SIG_PUSHONLY", "P2SH(P2PK) with non-push scriptSig but no SIGPUSHONLY" ], [ - "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP9 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", + "0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP8 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", "HASH160 0x14 0x215640c2f72f0d16b4eced26762035a42ffed39a EQUAL", "SIGPUSHONLY", "SIG_PUSHONLY", diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index b6e7224a4..38a4d81fb 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -719,16 +719,16 @@ BOOST_AUTO_TEST_CASE(script_build) ).Num(0).PushSig(keys.key1).Add(CScript() << OP_DUP).ScriptError(SCRIPT_ERR_SIG_PUSHONLY)); tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG, "P2SH(P2PK) with non-push scriptSig but no P2SH or SIGPUSHONLY", 0, true - ).PushSig(keys.key2).Add(CScript() << OP_NOP9).PushRedeem()); + ).PushSig(keys.key2).Add(CScript() << OP_NOP8).PushRedeem()); tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG, "P2PK with non-push scriptSig but with P2SH validation", 0 ).PushSig(keys.key2).Add(CScript() << OP_NOP9)); tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG, "P2SH(P2PK) with non-push scriptSig but no SIGPUSHONLY", SCRIPT_VERIFY_P2SH, true - ).PushSig(keys.key2).Add(CScript() << OP_NOP9).PushRedeem().ScriptError(SCRIPT_ERR_SIG_PUSHONLY)); + ).PushSig(keys.key2).Add(CScript() << OP_NOP8).PushRedeem().ScriptError(SCRIPT_ERR_SIG_PUSHONLY)); tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG, "P2SH(P2PK) with non-push scriptSig but not P2SH", SCRIPT_VERIFY_SIGPUSHONLY, true - ).PushSig(keys.key2).Add(CScript() << OP_NOP9).PushRedeem().ScriptError(SCRIPT_ERR_SIG_PUSHONLY)); + ).PushSig(keys.key2).Add(CScript() << OP_NOP8).PushRedeem().ScriptError(SCRIPT_ERR_SIG_PUSHONLY)); tests.push_back(TestBuilder(CScript() << OP_2 << ToByteVector(keys.pubkey1C) << ToByteVector(keys.pubkey1C) << OP_2 << OP_CHECKMULTISIG, "2-of-2 with two identical keys and sigs pushed", SCRIPT_VERIFY_SIGPUSHONLY ).Num(0).PushSig(keys.key1).PushSig(keys.key1)); diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 5bcfd4b99..982d690e2 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -558,27 +559,27 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) std::string 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); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET); 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); - BOOST_CHECK_EQUAL(test_args.GetChainName(), "lbrycrdtest"); + BOOST_CHECK_EQUAL(test_args.GetChainName(), CBaseChainParams::TESTNET); test_args.ParseParameters(3, (char**)argv_both, error); BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error); 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); 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); test_args.ParseParameters(2, (char**)argv_regtest, error); 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.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.ReadConfigString(testnetconf); @@ -598,11 +599,11 @@ BOOST_AUTO_TEST_CASE(util_GetChainName) 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); 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); test_args.ParseParameters(2, (char**)argv_regtest, error); 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.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.ReadConfigString(testnetconf);