From f2f919bd30cebf469f41caa825e8050a3db91a0b Mon Sep 17 00:00:00 2001 From: David Eichel Date: Fri, 19 Jan 2024 22:34:55 -0500 Subject: [PATCH 1/7] Set digishieldConensus to start at block 1. --- src/chainparams.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 762fa0552..906f508c2 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -125,7 +125,7 @@ class CMainParams : public CChainParams { // Blocks 1000 - 1499 are Digishield without AuxPoW digishieldConsensus = consensus; - digishieldConsensus.nHeightEffective = 1000; + digishieldConsensus.nHeightEffective = 1; digishieldConsensus.fSimplifiedRewards = true; digishieldConsensus.fDigishieldDifficultyCalculation = true; digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute @@ -200,12 +200,6 @@ class CTestNetParams : public CChainParams { strNetworkID = "test"; // Blocks 0 - 144999 are pre-Digishield - consensus.nHeightEffective = 0; - consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours - consensus.fDigishieldDifficultyCalculation = false; - consensus.nCoinbaseMaturity = 30; - consensus.fPowAllowMinDifficultyBlocks = true; - consensus.fPowAllowDigishieldMinDifficultyBlocks = false; consensus.nSubsidyHalvingInterval = 100000; consensus.nMajorityEnforceBlockUpgrade = 501; consensus.nMajorityRejectBlockOutdated = 750; @@ -218,6 +212,10 @@ class CTestNetParams : public CChainParams { consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20; consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours consensus.nPowTargetSpacing = 60; // 1 minute + consensus.fDigishieldDifficultyCalculation = false; + consensus.nCoinbaseMaturity = 30; + consensus.fPowAllowMinDifficultyBlocks = true; + consensus.fPowAllowDigishieldMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 2880; // 2 days (note this is significantly lower than Bitcoin standard) consensus.nMinerConfirmationWindow = 10080; // 60 * 24 * 7 = 10,080 blocks, or one week From 476a5b761f1d77a9331c6895a24af856d0692260 Mon Sep 17 00:00:00 2001 From: David Eichel Date: Sat, 20 Jan 2024 14:33:13 -0500 Subject: [PATCH 2/7] Set fDigishieldDifficultyCalculation initial value to true --- src/chainparams.cpp | 4 ++-- src/test/miner_tests.cpp | 48 ++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 906f508c2..ca08fa47c 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -88,7 +88,7 @@ class CMainParams : public CChainParams { consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20; consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours consensus.nPowTargetSpacing = 60; // 1 minute - consensus.fDigishieldDifficultyCalculation = false; + consensus.fDigishieldDifficultyCalculation = true; consensus.nCoinbaseMaturity = 30; consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowAllowDigishieldMinDifficultyBlocks = false; @@ -212,7 +212,7 @@ class CTestNetParams : public CChainParams { consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20; consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours consensus.nPowTargetSpacing = 60; // 1 minute - consensus.fDigishieldDifficultyCalculation = false; + consensus.fDigishieldDifficultyCalculation = true; consensus.nCoinbaseMaturity = 30; consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowAllowDigishieldMinDifficultyBlocks = false; diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index ec5d0636a..d91d6f900 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -228,30 +228,36 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) pblock->hashMerkleRoot = BlockMerkleRoot(*pblock); pblock->nNonce = blockinfo[i].nonce; + // Uncomment this code and it will generate the blockinfo at the top of this file. + // It grabs the extranonce (the first value of each tuple) and uses it to generate the nonce (the second value) + // You can run this in parallel incrementing the extranonces each time you run it, to generate the block info faster + // This is why you see many different values for the extra nonces. If you want, you can set them all to 1. + // It doesn't matter. This code will find the nonces for each extranonce. + + // // CValidationState state; + // // pblock->fChecked = false; + // // std::cout << "Checked? " << pblock->fChecked << std::endl; + // BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); + // CBlockIndex* pindexPrev = (*mi).second; // CValidationState state; - // pblock->fChecked = false; - // std::cout << "Checked? " << pblock->fChecked << std::endl; - BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); - CBlockIndex* pindexPrev = (*mi).second; - CValidationState state; - if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - pblock->nNonce = 0; - std::cout << "Mining Block " << i+1 << std::endl; - while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - ++pblock->nNonce; - if (pblock->nNonce % 100000 == 0) { - printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - } - } - printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - // CheckBlock(); - } + // if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + // pblock->nNonce = 0; + // std::cout << "Mining Block " << i+1 << std::endl; + // while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + // ++pblock->nNonce; + // if (pblock->nNonce % 100000 == 0) { + // printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + // } + // } + // printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + // // CheckBlock(); + // } - // std::cout << "Block Valid? " << CheckBlock(*pblock, state) << std::endl; - // std::cout << "Adding block " << i << "... " << std::endl; - // std::cout << "Hash: " << pblock->GetHash().ToString() << "Prev Hash: " << pblock->hashPrevBlock.ToString() << std::endl; - // std::cout << pblock->ToString() << std::endl; + // // std::cout << "Block Valid? " << CheckBlock(*pblock, state) << std::endl; + // // std::cout << "Adding block " << i << "... " << std::endl; + // // std::cout << "Hash: " << pblock->GetHash().ToString() << "Prev Hash: " << pblock->hashPrevBlock.ToString() << std::endl; + // // std::cout << pblock->ToString() << std::endl; std::shared_ptr shared_pblock = std::make_shared(*pblock); From bc592eef3b42c342ce21827a32c60e4b8c3c9db2 Mon Sep 17 00:00:00 2001 From: David Eichel Date: Sat, 20 Jan 2024 16:40:45 -0500 Subject: [PATCH 3/7] set nPowTargetTimespan to 1 minute --- src/chainparams.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ca08fa47c..0ef61e439 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -86,7 +86,7 @@ class CMainParams : public CChainParams { consensus.BIP65Height = 1000; consensus.BIP66Height = 1000; consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20; - consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours + consensus.nPowTargetTimespan = 60; // 1 minute consensus.nPowTargetSpacing = 60; // 1 minute consensus.fDigishieldDifficultyCalculation = true; consensus.nCoinbaseMaturity = 30; @@ -210,7 +210,7 @@ class CTestNetParams : public CChainParams { consensus.BIP65Height = 1000; // consensus.BIP66Height = 1000; // - this is the last block that could be v2, 1900 blocks past the last v2 block consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20; - consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours + consensus.nPowTargetTimespan = 60; // 1 minute consensus.nPowTargetSpacing = 60; // 1 minute consensus.fDigishieldDifficultyCalculation = true; consensus.nCoinbaseMaturity = 30; From af4863d562a297a495aa6551e62eaa477bc14b8a Mon Sep 17 00:00:00 2001 From: David Eichel Date: Sun, 21 Jan 2024 16:28:02 -0500 Subject: [PATCH 4/7] Resolve test failures from setting nPowTargetTimespan to 60 seconds --- src/chainparams.cpp | 2 +- src/test/miner_tests.cpp | 16 ++++++---------- src/test/pepecoin_tests.cpp | 12 ++++++------ src/test/pow_tests.cpp | 4 ++-- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 0ef61e439..7c9c19675 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -125,7 +125,7 @@ class CMainParams : public CChainParams { // Blocks 1000 - 1499 are Digishield without AuxPoW digishieldConsensus = consensus; - digishieldConsensus.nHeightEffective = 1; + digishieldConsensus.nHeightEffective = 1000; digishieldConsensus.fSimplifiedRewards = true; digishieldConsensus.fDigishieldDifficultyCalculation = true; digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index d91d6f900..8a85c547a 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -234,9 +234,12 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // This is why you see many different values for the extra nonces. If you want, you can set them all to 1. // It doesn't matter. This code will find the nonces for each extranonce. - // // CValidationState state; - // // pblock->fChecked = false; - // // std::cout << "Checked? " << pblock->fChecked << std::endl; + //DO NOT FORGET TO COMMENT THIS OUT DURING BUILDS. + //If the code below isn't commented out, it will make "make check" run for hours looking for 100 blocks + //It will also make your github action builds run for hours + //If your tests are hanging and you don't know why, it's probably this code + + // pblock->fChecked = false; // BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); // CBlockIndex* pindexPrev = (*mi).second; // CValidationState state; @@ -250,15 +253,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // } // } // printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - // // CheckBlock(); // } - - // // std::cout << "Block Valid? " << CheckBlock(*pblock, state) << std::endl; - // // std::cout << "Adding block " << i << "... " << std::endl; - // // std::cout << "Hash: " << pblock->GetHash().ToString() << "Prev Hash: " << pblock->hashPrevBlock.ToString() << std::endl; - // // std::cout << pblock->ToString() << std::endl; - std::shared_ptr shared_pblock = std::make_shared(*pblock); BOOST_CHECK(ProcessNewBlock(chainparams, shared_pblock, true, NULL)); diff --git a/src/test/pepecoin_tests.cpp b/src/test/pepecoin_tests.cpp index 74e2bafc8..fb9732b6b 100644 --- a/src/test/pepecoin_tests.cpp +++ b/src/test/pepecoin_tests.cpp @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_difficulty_limit) pindexLast.nHeight = 239; pindexLast.nTime = 1386475638; // Block #239 pindexLast.nBits = 0x1e0ffff0; - BOOST_CHECK_EQUAL(CalculatePepecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1e00ffff); + BOOST_CHECK_EQUAL(CalculatePepecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1e0fffff); } BOOST_AUTO_TEST_CASE(get_next_work_pre_digishield) @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_pre_digishield) pindexLast.nHeight = 9599; pindexLast.nTime = 1386954113; pindexLast.nBits = 0x1c1a1206; - BOOST_CHECK_EQUAL(CalculatePepecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c15ea59); + BOOST_CHECK_EQUAL(CalculatePepecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c271b09); } BOOST_AUTO_TEST_CASE(get_next_work_digishield) @@ -174,14 +174,14 @@ BOOST_AUTO_TEST_CASE(hardfork_parameters) SelectParams(CBaseChainParams::MAIN); const Consensus::Params& initialParams = Params().GetConsensus(0); - BOOST_CHECK_EQUAL(initialParams.nPowTargetTimespan, 14400); + BOOST_CHECK_EQUAL(initialParams.nPowTargetTimespan, 60); BOOST_CHECK_EQUAL(initialParams.fAllowLegacyBlocks, true); - BOOST_CHECK_EQUAL(initialParams.fDigishieldDifficultyCalculation, false); + BOOST_CHECK_EQUAL(initialParams.fDigishieldDifficultyCalculation, true); const Consensus::Params& initialParamsEnd = Params().GetConsensus(999); - BOOST_CHECK_EQUAL(initialParamsEnd.nPowTargetTimespan, 14400); + BOOST_CHECK_EQUAL(initialParamsEnd.nPowTargetTimespan, 60); BOOST_CHECK_EQUAL(initialParamsEnd.fAllowLegacyBlocks, true); - BOOST_CHECK_EQUAL(initialParamsEnd.fDigishieldDifficultyCalculation, false); + BOOST_CHECK_EQUAL(initialParamsEnd.fDigishieldDifficultyCalculation, true); const Consensus::Params& digishieldParams = Params().GetConsensus(1000);//PEPE TODO Magic number BOOST_CHECK_EQUAL(digishieldParams.nPowTargetTimespan, 60); diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 3953ceeef..98f40621f 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE(get_next_work) pindexLast.nHeight = 30479; pindexLast.nTime = 1388163922; // Block #30479 pindexLast.nBits = 0x1c00974f; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0093a1); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c025d3c); } /* Test the constraint on the upper bound for next work */ @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) pindexLast.nHeight = 66767; pindexLast.nTime = 1279008237 + (239 * 60 / 4 - 1); // Bitcoin Block #66528 + less than a quarter of the target timespan pindexLast.nBits = 0x1c05a3f4; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c168fd0); } /* Test the constraint on the upper bound for actual time taken */ From 8ed506da177b88fe732fd9a35b8bc9b44f511e5f Mon Sep 17 00:00:00 2001 From: David Eichel Date: Sun, 21 Jan 2024 19:58:51 -0500 Subject: [PATCH 5/7] Add new genesis block for testing --- src/chainparams.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7c9c19675..d15580609 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -114,7 +114,7 @@ class CMainParams : public CChainParams { consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000000000000000010001"); // genesis block // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("0xb8fac7f8275af1072b983884fb128165862d7849d8f7d7841f282fb6f6c0b7a6"); // genesis block + consensus.defaultAssumeValid = uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584"); // genesis block // AuxPoW parameters consensus.nAuxpowChainId = 0x003f; // 63 @@ -154,11 +154,11 @@ class CMainParams : public CChainParams { nDefaultPort = 33874; nPruneAfterHeight = 100000; - genesis = CreateGenesisBlock(1705384800, 777983, 0x1e0ffff0, 1, 88 * COIN); + genesis = CreateGenesisBlock(1705899500, 875428, 0x1e0ffff0, 1, 88 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock; auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock; - assert(consensus.hashGenesisBlock == uint256S("0xb8fac7f8275af1072b983884fb128165862d7849d8f7d7841f282fb6f6c0b7a6")); + assert(consensus.hashGenesisBlock == uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584")); assert(genesis.hashMerkleRoot == uint256S("0xd738744097ee4ee58036e9f500324b6335f3fdc41df704c5579bc5416be4a6eb")); // Note that of those with the service bits flag, most only support a subset of possible options @@ -179,7 +179,7 @@ class CMainParams : public CChainParams { checkpointData = (CCheckpointData) { boost::assign::map_list_of - ( 0, uint256S("0xb8fac7f8275af1072b983884fb128165862d7849d8f7d7841f282fb6f6c0b7a6")) + ( 0, uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584")) }; chainTxData = ChainTxData{ }; From d0c5ed40bebd93977108945cac4004c79fdfe433 Mon Sep 17 00:00:00 2001 From: David Eichel Date: Tue, 23 Jan 2024 04:57:02 -0500 Subject: [PATCH 6/7] Add new genesis block --- src/chainparams.cpp | 40 ++++++++--------- src/qt/test/rpcnestedtests.cpp | 2 +- src/test/miner_tests.cpp | 80 +++++++++++++++++----------------- src/test/pepecoin_tests.cpp | 6 +-- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index d15580609..07f039dcf 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -51,7 +51,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi */ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { - const char* pszTimestamp = "WSJ 1/10/24 - SEC Approves Bitcoin ETFs for Everyday Investors"; + const char* pszTimestamp = "WSJ 1/22/24 - Fed Review Clears Central Bank Officials of Violating Rules"; const CScript genesisOutputScript = CScript() << ParseHex("0436d04f40a76a1094ea10b14a513b62bfd0b47472dda1c25aa9cf8266e53f3c4353680146177f8a3b328ed2c6e02f2b8e051d9d5ffc61a4e6ccabd03409109a5a") << OP_CHECKSIG; return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); } @@ -114,7 +114,7 @@ class CMainParams : public CChainParams { consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000000000000000010001"); // genesis block // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584"); // genesis block + consensus.defaultAssumeValid = uint256S("0x37981c0c48b8d48965376c8a42ece9a0838daadb93ff975cb091f57f8c2a5faa"); // genesis block // AuxPoW parameters consensus.nAuxpowChainId = 0x003f; // 63 @@ -123,7 +123,7 @@ class CMainParams : public CChainParams { consensus.nHeightEffective = 0; consensus.fSimplifiedRewards = true; - // Blocks 1000 - 1499 are Digishield without AuxPoW + // Blocks 1000 - 99,999 are Digishield without AuxPoW digishieldConsensus = consensus; digishieldConsensus.nHeightEffective = 1000; digishieldConsensus.fSimplifiedRewards = true; @@ -131,10 +131,10 @@ class CMainParams : public CChainParams { digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute digishieldConsensus.nCoinbaseMaturity = 240; - // Blocks 1500+ are AuxPoW + // Blocks 100,000+ are AuxPoW // Some tests from Dogecoin expect non-auxpow blocks. This allows those tests to pass. auxpowConsensus = digishieldConsensus; - auxpowConsensus.nHeightEffective = 1500; + auxpowConsensus.nHeightEffective = 100000; auxpowConsensus.fAllowLegacyBlocks = false; // Assemble the binary search tree of consensus parameters @@ -154,12 +154,12 @@ class CMainParams : public CChainParams { nDefaultPort = 33874; nPruneAfterHeight = 100000; - genesis = CreateGenesisBlock(1705899500, 875428, 0x1e0ffff0, 1, 88 * COIN); + genesis = CreateGenesisBlock(1705975200, 427444, 0x1e0ffff0, 1, 88 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock; auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock; - assert(consensus.hashGenesisBlock == uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584")); - assert(genesis.hashMerkleRoot == uint256S("0xd738744097ee4ee58036e9f500324b6335f3fdc41df704c5579bc5416be4a6eb")); + assert(consensus.hashGenesisBlock == uint256S("0x37981c0c48b8d48965376c8a42ece9a0838daadb93ff975cb091f57f8c2a5faa")); + assert(genesis.hashMerkleRoot == uint256S("0xd22a1ba59a39cbd5904624933efb822c8baa121f97060c4cc9ea2f00a4bc6512")); // Note that of those with the service bits flag, most only support a subset of possible options vSeeds.push_back(CDNSSeedData("pepecoin.org", "seeds.pepecoin.org")); @@ -179,7 +179,7 @@ class CMainParams : public CChainParams { checkpointData = (CCheckpointData) { boost::assign::map_list_of - ( 0, uint256S("0x6f40798501953e32f869eac2d7b0e09d965721a61ed46b30df894d95c2fed584")) + ( 0, uint256S("0x37981c0c48b8d48965376c8a42ece9a0838daadb93ff975cb091f57f8c2a5faa")) }; chainTxData = ChainTxData{ }; @@ -238,7 +238,7 @@ class CTestNetParams : public CChainParams { consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000000000000000010001"); // genesis block // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("0x1cd0b7925f5458a232a81eb10b5af2fccd202d6973d57fc0dd0ccf862cae09d2"); // genesis block + consensus.defaultAssumeValid = uint256S("0xf9f4ea4ae7f6ea4c55040ede2019ba0a53e262f46ec9bce3dcda2cb11f96fc52"); // genesis block // AuxPoW parameters consensus.nAuxpowChainId = 0x003f; // 63 @@ -256,15 +256,15 @@ class CTestNetParams : public CChainParams { digishieldConsensus.fPowAllowMinDifficultyBlocks = false; digishieldConsensus.nCoinbaseMaturity = 240; - // Blocks 1250 - 1499 are Digishield with minimum difficulty on all blocks + // Blocks 1250 - 99,999 are Digishield with minimum difficulty on all blocks minDifficultyConsensus = digishieldConsensus; minDifficultyConsensus.nHeightEffective = 1250; minDifficultyConsensus.fPowAllowDigishieldMinDifficultyBlocks = true; minDifficultyConsensus.fPowAllowMinDifficultyBlocks = true; - // Enable AuxPoW at 1500 + // Enable AuxPoW at 100,000 auxpowConsensus = minDifficultyConsensus; - auxpowConsensus.nHeightEffective = 1500; + auxpowConsensus.nHeightEffective = 100000; auxpowConsensus.fPowAllowDigishieldMinDifficultyBlocks = true; auxpowConsensus.fAllowLegacyBlocks = false; @@ -281,14 +281,14 @@ class CTestNetParams : public CChainParams { nDefaultPort = 44874; nPruneAfterHeight = 1000; - genesis = CreateGenesisBlock(1705384860, 326706, 0x1e0ffff0, 1, 88 * COIN); + genesis = CreateGenesisBlock(1705975260, 3476, 0x1e0ffff0, 1, 88 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock; minDifficultyConsensus.hashGenesisBlock = consensus.hashGenesisBlock; auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock; - assert(consensus.hashGenesisBlock == uint256S("0x1cd0b7925f5458a232a81eb10b5af2fccd202d6973d57fc0dd0ccf862cae09d2")); - assert(genesis.hashMerkleRoot == uint256S("0xd738744097ee4ee58036e9f500324b6335f3fdc41df704c5579bc5416be4a6eb")); + assert(consensus.hashGenesisBlock == uint256S("0xf9f4ea4ae7f6ea4c55040ede2019ba0a53e262f46ec9bce3dcda2cb11f96fc52")); + assert(genesis.hashMerkleRoot == uint256S("0xd22a1ba59a39cbd5904624933efb822c8baa121f97060c4cc9ea2f00a4bc6512")); vSeeds.clear(); // nodes with support for servicebits filtering should be at the top @@ -309,7 +309,7 @@ class CTestNetParams : public CChainParams { checkpointData = (CCheckpointData) { boost::assign::map_list_of - ( 0, uint256S("0x1cd0b7925f5458a232a81eb10b5af2fccd202d6973d57fc0dd0ccf862cae09d2")) + ( 0, uint256S("0xf9f4ea4ae7f6ea4c55040ede2019ba0a53e262f46ec9bce3dcda2cb11f96fc52")) }; chainTxData = ChainTxData{ }; @@ -394,8 +394,8 @@ class CRegTestParams : public CChainParams { consensus.hashGenesisBlock = genesis.GetHash(); digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock; auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock; - assert(consensus.hashGenesisBlock == uint256S("0xfda0727b210f4d79f9abec20d95f8e3699e717aba00c37142ee97a8decab404c")); - assert(genesis.hashMerkleRoot == uint256S("0xd738744097ee4ee58036e9f500324b6335f3fdc41df704c5579bc5416be4a6eb")); + assert(consensus.hashGenesisBlock == uint256S("0x770975b0f98319520694563de107ff94fd501c0d1c16f3a405868faf36b51c28")); + assert(genesis.hashMerkleRoot == uint256S("0xd22a1ba59a39cbd5904624933efb822c8baa121f97060c4cc9ea2f00a4bc6512")); vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds. vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds. @@ -407,7 +407,7 @@ class CRegTestParams : public CChainParams { checkpointData = (CCheckpointData){ boost::assign::map_list_of - ( 0, uint256S("0xfda0727b210f4d79f9abec20d95f8e3699e717aba00c37142ee97a8decab404c")) + ( 0, uint256S("0x770975b0f98319520694563de107ff94fd501c0d1c16f3a405868faf36b51c28")) }; chainTxData = ChainTxData{ diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 5a431cd2d..32b004ece 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -91,7 +91,7 @@ void RPCNestedTests::rpcNestedTests() QVERIFY(result == result2); RPCConsole::RPCExecuteCommandLine(result, "getblock(getbestblockhash())[tx][0]", &filtered); - QVERIFY(result == "d738744097ee4ee58036e9f500324b6335f3fdc41df704c5579bc5416be4a6eb"); + QVERIFY(result == "d22a1ba59a39cbd5904624933efb822c8baa121f97060c4cc9ea2f00a4bc6512"); QVERIFY(filtered == "getblock(getbestblockhash())[tx][0]"); RPCConsole::RPCParseCommandLine(result, "importprivkey", false, &filtered); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 8a85c547a..4367bb000 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -33,31 +33,31 @@ struct { unsigned char extranonce; unsigned int nonce; } blockinfo[] = { - {2, 0x0007c417}, {12, 0x001b9522}, {1, 0x00023c61}, {1, 0x00077366}, - {1, 0x0011af77}, {1, 0x001ce11d}, {3, 0x00090ece}, {4, 0x0003acb0}, - {1, 0x00026a84}, {1, 0x00000871}, {3, 0x00016a1f}, {1, 0x00006d91}, - {1, 0x0008d3e1}, {1, 0x00031c3a}, {1, 0x001806b1}, {1, 0x000054d7}, - {1, 0x00009b63}, {3, 0x00151484}, {1, 0x000f55b5}, {1, 0x00104ccc}, - {1, 0x00040e31}, {5, 0x00054c0d}, {2, 0x0003f39c}, {3, 0x0002b159}, - {4, 0x0004042b}, {4, 0x0009f8ad}, {4, 0x000214bd}, {2, 0x00073712}, - {2, 0x0008a071}, {1, 0x0002bf53}, {3, 0x00036d5e}, {2, 0x000b5c52}, - {2, 0x0016795d}, {1, 0x0018780a}, {3, 0x00004b97}, {4, 0x000197d7}, - {1, 0x000ee8bc}, {3, 0x00117e4c}, {1, 0x002a4418}, {2, 0x0005c535}, - {1, 0x0005cf15}, {2, 0x00060417}, {1, 0x00007281}, {4, 0x00005f10}, - {3, 0x0012fb88}, {5, 0x0000f589}, {1, 0x00013a84}, {3, 0x001862a1}, - {1, 0x0007dda3}, {3, 0x00004493}, {3, 0x000c3659}, {1, 0x00012034}, - {1, 0x001220d5}, {1, 0x0001086a}, {1, 0x000d7572}, {1, 0x0017f08c}, - {4, 0x000c02b3}, {1, 0x0002cc41}, {1, 0x000e114f}, {3, 0x0004c28f}, - {2, 0x000a16e7}, {1, 0x00210025}, {1, 0x00021638}, {4, 0x000ac561}, - {1, 0x000c17df}, {1, 0x0016fb9d}, {4, 0x0012e226}, {1, 0x0019c27e}, - {2, 0x00233d00}, {2, 0x0009d44e}, {1, 0x00063d30}, {4, 0x00008f9b}, - {2, 0x000648cc}, {7, 0x000587b0}, {1, 0x001198c4}, {2, 0x0003dbfe}, - {7, 0x00074a98}, {5, 0x00009876}, {5, 0x00029fe5}, {3, 0x00043935}, - {4, 0x00124825}, {4, 0x000a244f}, {3, 0x001e3837}, {3, 0x00025c32}, - {7, 0x00185da1}, {3, 0x0005f426}, {3, 0x000e59f2}, {1, 0x0005ed50}, - {2, 0x00016087}, {8, 0x0001a0b5}, {6, 0x001a48f5}, {2, 0x00026836}, - {1, 0x0006626c}, {3, 0x000ccfd0}, {3, 0x00017a59}, {3, 0x00020545}, - {4, 0x000308e8}, {2, 0x0004b060}, {3, 0x0005dbc6}, {1, 0x0006fd85} + {2, 0x0003a807}, {12, 0x000317c6}, {1, 0x0006c339}, {1, 0x0012615f}, + {1, 0x001eaaa7}, {1, 0x0039a340}, {3, 0x00109dbe}, {4, 0x00050b0e}, + {1, 0x00053337}, {1, 0x001fd8de}, {3, 0x000c7df1}, {1, 0x0000f5cb}, + {1, 0x000ff609}, {1, 0x000a81e6}, {1, 0x000b2811}, {1, 0x000a0ada}, + {1, 0x0007192c}, {3, 0x000c7698}, {1, 0x00117efc}, {1, 0x0009a6b7}, + {1, 0x003e3d2b}, {5, 0x0009ac29}, {2, 0x000a2661}, {3, 0x0012f6e6}, + {4, 0x000ccb74}, {4, 0x000743f8}, {4, 0x000e9543}, {2, 0x001dba12}, + {2, 0x003d223a}, {1, 0x00228416}, {3, 0x000677a1}, {2, 0x00144589}, + {2, 0x000de667}, {1, 0x000789a1}, {3, 0x001e2ec3}, {4, 0x002161ee}, + {1, 0x001151cb}, {3, 0x000a639e}, {1, 0x0027c35c}, {2, 0x0028c0b5}, + {1, 0x0002d4bd}, {2, 0x0001bf45}, {1, 0x00083ac0}, {4, 0x0001f7ca}, + {3, 0x00039b53}, {5, 0x00019a07}, {1, 0x0014f693}, {3, 0x000432ad}, + {1, 0x0028406a}, {3, 0x00332e99}, {3, 0x0000242d}, {1, 0x000507cf}, + {1, 0x0006f1c6}, {1, 0x0012b50e}, {1, 0x0015ddec}, {1, 0x0018b451}, + {4, 0x000db113}, {1, 0x00009382}, {1, 0x00123d86}, {3, 0x000a853e}, + {2, 0x004c4a44}, {1, 0x0015fd9a}, {1, 0x00098093}, {4, 0x001d1fbb}, + {1, 0x000046bb}, {1, 0x0012e36a}, {4, 0x000330e5}, {1, 0x001b76d9}, + {2, 0x00184361}, {2, 0x0000cafa}, {1, 0x000daf34}, {4, 0x003d6499}, + {2, 0x00092455}, {7, 0x0006865e}, {1, 0x00071e24}, {2, 0x00002369}, + {7, 0x0007a38a}, {5, 0x00102937}, {5, 0x0001674e}, {3, 0x000239f4}, + {4, 0x000893e9}, {4, 0x0036215b}, {3, 0x0001d6b5}, {3, 0x0004425d}, + {7, 0x001688f0}, {3, 0x00019b65}, {3, 0x0020b8b5}, {1, 0x00087efb}, + {2, 0x000e62a2}, {8, 0x0012bac0}, {6, 0x00026b24}, {2, 0x0001b958}, + {1, 0x00037339}, {3, 0x000a64ee}, {3, 0x00024ceb}, {3, 0x000e4af4}, + {4, 0x000ac24e}, {2, 0x000d76c0}, {3, 0x00055a58}, {1, 0x000d13a5} }; @@ -239,21 +239,21 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) //It will also make your github action builds run for hours //If your tests are hanging and you don't know why, it's probably this code - // pblock->fChecked = false; - // BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); - // CBlockIndex* pindexPrev = (*mi).second; - // CValidationState state; - // if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - // pblock->nNonce = 0; - // std::cout << "Mining Block " << i+1 << std::endl; - // while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - // ++pblock->nNonce; - // if (pblock->nNonce % 100000 == 0) { - // printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - // } - // } - // printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - // } + pblock->fChecked = false; + BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); + CBlockIndex* pindexPrev = (*mi).second; + CValidationState state; + if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + pblock->nNonce = 0; + std::cout << "Mining Block " << i+1 << std::endl; + while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + ++pblock->nNonce; + // if (pblock->nNonce % 100000 == 0) { + // printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + // } + } + printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + } std::shared_ptr shared_pblock = std::make_shared(*pblock); diff --git a/src/test/pepecoin_tests.cpp b/src/test/pepecoin_tests.cpp index fb9732b6b..1608497a1 100644 --- a/src/test/pepecoin_tests.cpp +++ b/src/test/pepecoin_tests.cpp @@ -188,13 +188,13 @@ BOOST_AUTO_TEST_CASE(hardfork_parameters) BOOST_CHECK_EQUAL(digishieldParams.fAllowLegacyBlocks, true); BOOST_CHECK_EQUAL(digishieldParams.fDigishieldDifficultyCalculation, true); - const Consensus::Params& digishieldParamsEnd = Params().GetConsensus(1499); + const Consensus::Params& digishieldParamsEnd = Params().GetConsensus(99999); BOOST_CHECK_EQUAL(digishieldParamsEnd.nPowTargetTimespan, 60); BOOST_CHECK_EQUAL(digishieldParamsEnd.fAllowLegacyBlocks, true); BOOST_CHECK_EQUAL(digishieldParamsEnd.fDigishieldDifficultyCalculation, true); - const Consensus::Params& auxpowParams = Params().GetConsensus(1500);//PEPE TODO Magic number - BOOST_CHECK_EQUAL(auxpowParams.nHeightEffective, 1500);//PEPE TODO Magic number + const Consensus::Params& auxpowParams = Params().GetConsensus(100000);//PEPE TODO Magic number + BOOST_CHECK_EQUAL(auxpowParams.nHeightEffective, 100000);//PEPE TODO Magic number BOOST_CHECK_EQUAL(auxpowParams.nPowTargetTimespan, 60); BOOST_CHECK_EQUAL(auxpowParams.fAllowLegacyBlocks, false); BOOST_CHECK_EQUAL(auxpowParams.fDigishieldDifficultyCalculation, true); From 6400cb42890fd242536fc7187df7a1cf102e5304 Mon Sep 17 00:00:00 2001 From: David Eichel Date: Tue, 23 Jan 2024 06:43:19 -0500 Subject: [PATCH 7/7] Comment out blockInfo generator in miner_tests.cpp --- src/test/miner_tests.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 4367bb000..0ef4035bd 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -239,21 +239,21 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) //It will also make your github action builds run for hours //If your tests are hanging and you don't know why, it's probably this code - pblock->fChecked = false; - BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); - CBlockIndex* pindexPrev = (*mi).second; - CValidationState state; - if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - pblock->nNonce = 0; - std::cout << "Mining Block " << i+1 << std::endl; - while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { - ++pblock->nNonce; - // if (pblock->nNonce % 100000 == 0) { - // printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - // } - } - printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); - } + // pblock->fChecked = false; + // BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); + // CBlockIndex* pindexPrev = (*mi).second; + // CValidationState state; + // if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + // pblock->nNonce = 0; + // std::cout << "Mining Block " << i+1 << std::endl; + // while (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, true) || !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, chainparams.GetConsensus(chainActive.Height()))) { + // ++pblock->nNonce; + // if (pblock->nNonce % 100000 == 0) { + // printf("Block %d: %d, %d\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + // } + // } + // printf("Block %d mined: %d, 0x%08x\n", i+1, blockinfo[i].extranonce, pblock->nNonce); + // } std::shared_ptr shared_pblock = std::make_shared(*pblock);