diff options
| author | Ross Nicoll <[email protected]> | 2018-09-19 15:58:29 +0100 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2021-05-20 12:02:35 +0100 |
| commit | 0817a1bced90d59fb4d268c77f6c46ff1b02b012 (patch) | |
| tree | b125c9ea669fd1c3761cdbaa6872ad228443a232 /src/test | |
| parent | Adjust download timeouts to handle shorter block interval (#1866) (diff) | |
| download | discoin-0817a1bced90d59fb4d268c77f6c46ff1b02b012.tar.xz discoin-0817a1bced90d59fb4d268c77f6c46ff1b02b012.zip | |
Update miner confirmation window
* Update miner confirmation window to 240 for Dogecoin main net, and update related values.
* Re-enable PoW tests with Dogecoin values.
* Update version bit tests based on Dogecoin mining values.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/pow_tests.cpp | 16 | ||||
| -rw-r--r-- | src/test/versionbits_tests.cpp | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 1d7f4861f..bb4d2ce4b 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -15,12 +15,12 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(get_next_work) { const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN); - int64_t nLastRetargetTime = 1261130161; // Block #30240 + int64_t nLastRetargetTime = 1388149872; // Block #30240 CBlockIndex pindexLast; - pindexLast.nHeight = 32255; - pindexLast.nTime = 1262152739; // Block #32255 - pindexLast.nBits = 0x1d00ffff; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00d86aU); + pindexLast.nHeight = 30479; + pindexLast.nTime = 1388163922; // Block #30479 + pindexLast.nBits = 0x1c00974f; + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c0093a1U); } /* Test the constraint on the upper bound for next work */ @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) pindexLast.nHeight = 2015; pindexLast.nTime = 1233061996; // Block #2015 pindexLast.nBits = 0x1d00ffff; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffffU); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d03fffcU); } /* Test the constraint on the lower bound for actual time taken */ @@ -41,8 +41,8 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN); int64_t nLastRetargetTime = 1279008237; // Block #66528 CBlockIndex pindexLast; - pindexLast.nHeight = 68543; - pindexLast.nTime = 1279297671; // Block #68543 + 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, chainParams->GetConsensus()), 0x1c0168fdU); } diff --git a/src/test/versionbits_tests.cpp b/src/test/versionbits_tests.cpp index 50444f7bb..5de2d11af 100644 --- a/src/test/versionbits_tests.cpp +++ b/src/test/versionbits_tests.cpp @@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion) BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); // Check that ComputeBlockVersion will set the bit until nTimeout - nTime += 600; + nTime += 60; uint32_t blocksToMine = mainnetParams.nMinerConfirmationWindow * 2; // test blocks for up to 2 time periods uint32_t nHeight = mainnetParams.nMinerConfirmationWindow * 3; // These blocks are all before nTimeout is reached. @@ -306,7 +306,7 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion) BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); blocksToMine--; - nTime += 600; + nTime += 60; nHeight += 1; } |