From 9dd793f499254600efa468938cef9baa28ac81b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Sun, 5 Jul 2015 14:17:46 +0200 Subject: TRIVIAL: Missing includes --- src/test/pow_tests.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index a43674928..992f9c971 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -2,8 +2,11 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "chain.h" +#include "chainparams.h" #include "main.h" #include "pow.h" +#include "random.h" #include "util.h" #include "test/test_bitcoin.h" -- cgit v1.2.3 From 60c8bac77c6612b84e3496b2227a01058d720ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Sun, 5 Jul 2015 14:30:07 +0200 Subject: Includes: Cleanup around net main and wallet -Move from .h to .cpp: in main, net and wallet -Remove unnecessary #include "main.h" -Cleanup some wallet files includes --- src/test/pow_tests.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 992f9c971..b6eb39bc3 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -4,7 +4,6 @@ #include "chain.h" #include "chainparams.h" -#include "main.h" #include "pow.h" #include "random.h" #include "util.h" -- cgit v1.2.3 From 73f41190b91dce9c125b1828b18f7625e0200145 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Mon, 5 Dec 2016 16:03:53 +0900 Subject: Refactoring: Removed using namespace from bench/ and test/ source files. --- src/test/pow_tests.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index b6eb39bc3..4ca6f1caf 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -11,8 +11,6 @@ #include -using namespace std; - BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* Test calculation of next difficulty target with no constraints applying */ -- cgit v1.2.3 From 3cff8e9773332283a5471771edcdbd1fd9a07b21 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 18 Apr 2017 16:52:01 +0100 Subject: Replace test data with Dogecoin values Replace test data with Dogecoin equivalents in the folowing tests: * base58 * bip32 * keys * miner * pow Replace RPC and deterministic signatures in unit tests with Dogecoin values. While conventionally I'd use an alternative implementation for these, as RFC 6979 compliant signature generation isn't terribly common, and there's no reason to suspect we've modified this code, I'm going to assert that it's good enough to test that the code doesn't provide different values. Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are replaced by the Dogecoin PoW tests. --- src/test/pow_tests.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 4ca6f1caf..a51714ad7 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -14,7 +14,8 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* Test calculation of next difficulty target with no constraints applying */ -BOOST_AUTO_TEST_CASE(get_next_work) +// Replaced by Dogecoin-specific PoW test +/* BOOST_AUTO_TEST_CASE(get_next_work) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); @@ -25,10 +26,11 @@ BOOST_AUTO_TEST_CASE(get_next_work) pindexLast.nTime = 1262152739; // Block #32255 pindexLast.nBits = 0x1d00ffff; BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00d86a); -} +} */ /* Test the constraint on the upper bound for next work */ -BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) +// Replaced by Dogecoin-specific PoW test +/* BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); @@ -39,10 +41,11 @@ BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) pindexLast.nTime = 1233061996; // Block #2015 pindexLast.nBits = 0x1d00ffff; BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff); -} +} */ /* Test the constraint on the lower bound for actual time taken */ -BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) +// Replaced by Dogecoin-specific PoW test +/* BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); @@ -53,10 +56,11 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) pindexLast.nTime = 1279297671; // Block #68543 pindexLast.nBits = 0x1c05a3f4; BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd); -} +} */ /* Test the constraint on the upper bound for actual time taken */ -BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual) +// Replaced by Dogecoin-specific PoW test +/* BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); @@ -67,7 +71,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual) pindexLast.nTime = 1269211443; // Block #46367 pindexLast.nBits = 0x1c387f6f; BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00e1fd); -} +} */ BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test) { -- cgit v1.2.3 From 1be681a1b97b686f838af90682a57f2030d26015 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Thu, 28 Dec 2017 15:04:08 +0000 Subject: Modify chain consensus parameters to be height aware (#1396) * Modify chain consensus parameters to be height aware * Correct implementation of simplified rewards in parameters * Correct max money * Use base block version in IsSuperMajority() instead of full version * Correct mining of blocks in AuxPoW tests * Add in missing pre-AuxPoW consensus checks --- src/test/pow_tests.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index a51714ad7..a90e6896b 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -18,7 +18,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* BOOST_AUTO_TEST_CASE(get_next_work) { SelectParams(CBaseChainParams::MAIN); - const Consensus::Params& params = Params().GetConsensus(); + const Consensus::Params& params = Params().GetConsensus(0); int64_t nLastRetargetTime = 1261130161; // Block #30240 CBlockIndex pindexLast; @@ -33,7 +33,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) { SelectParams(CBaseChainParams::MAIN); - const Consensus::Params& params = Params().GetConsensus(); + const Consensus::Params& params = Params().GetConsensus(0); int64_t nLastRetargetTime = 1231006505; // Block #0 CBlockIndex pindexLast; @@ -48,7 +48,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) { SelectParams(CBaseChainParams::MAIN); - const Consensus::Params& params = Params().GetConsensus(); + const Consensus::Params& params = Params().GetConsensus(0); int64_t nLastRetargetTime = 1279008237; // Block #66528 CBlockIndex pindexLast; @@ -63,7 +63,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual) { SelectParams(CBaseChainParams::MAIN); - const Consensus::Params& params = Params().GetConsensus(); + const Consensus::Params& params = Params().GetConsensus(0); int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time CBlockIndex pindexLast; @@ -76,7 +76,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test) { SelectParams(CBaseChainParams::MAIN); - const Consensus::Params& params = Params().GetConsensus(); + const Consensus::Params& params = Params().GetConsensus(0); std::vector blocks(10000); for (int i = 0; i < 10000; i++) { -- cgit v1.2.3 From 199cf694ef955137f87138f78b9c0f010dcc90b6 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Wed, 19 Sep 2018 15:58:29 +0100 Subject: 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. --- src/test/pow_tests.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src/test/pow_tests.cpp') diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index a90e6896b..e112c7339 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -14,23 +14,21 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) /* Test calculation of next difficulty target with no constraints applying */ -// Replaced by Dogecoin-specific PoW test -/* BOOST_AUTO_TEST_CASE(get_next_work) +BOOST_AUTO_TEST_CASE(get_next_work) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(0); - 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, params), 0x1d00d86a); -} */ + pindexLast.nHeight = 30479; + pindexLast.nTime = 1388163922; // Block #30479 + pindexLast.nBits = 0x1c00974f; + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0093a1); +} /* Test the constraint on the upper bound for next work */ -// Replaced by Dogecoin-specific PoW test -/* BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) +BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(0); @@ -40,23 +38,22 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup) pindexLast.nHeight = 2015; pindexLast.nTime = 1233061996; // Block #2015 pindexLast.nBits = 0x1d00ffff; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff); -} */ + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d03fffc); +} /* Test the constraint on the lower bound for actual time taken */ -// Replaced by Dogecoin-specific PoW test -/* BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) +BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) { SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(0); 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, params), 0x1c0168fd); -} */ +} /* Test the constraint on the upper bound for actual time taken */ // Replaced by Dogecoin-specific PoW test -- cgit v1.2.3