From 8f3ec042af6111ef89b05ad48f1f05cfa21a785b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 6 Sep 2016 13:13:23 +1200 Subject: [PATCH] Expand bounds on difficulty adjustment --- src/chainparams.cpp | 4 ++-- src/test/pow_tests.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index a64d3ad98..4cbe8be40 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -42,8 +42,8 @@ public: //consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.nPowAveragingWindow = 17; - consensus.nPowMaxAdjustDown = 16; // 16% adjustment down - consensus.nPowMaxAdjustUp = 8; // 8% adjustment up + consensus.nPowMaxAdjustDown = 32; // 32% adjustment down + consensus.nPowMaxAdjustUp = 16; // 16% adjustment up consensus.nPowTargetSpacing = 2.5 * 60; consensus.fPowAllowMinDifficultyBlocks = false; /** diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 34680295e..e3a95682f 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -50,13 +50,13 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); - int64_t nLastRetargetTime = 1279295950; // NOTE: Not an actual block time + int64_t nLastRetargetTime = 1279296753; // NOTE: Not an actual block time CBlockIndex pindexLast; pindexLast.nHeight = 68543; pindexLast.nTime = 1279297671; // Block #68543 of Bitcoin // This represents an average difficulty in the current algorithm pindexLast.nBits = 0x1c05a3f4; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c05306f); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c04bceb); } /* Test the constraint on the upper bound for actual time taken */ @@ -65,13 +65,13 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual) SelectParams(CBaseChainParams::MAIN); const Consensus::Params& params = Params().GetConsensus(); - int64_t nLastRetargetTime = 1269207250; // NOTE: Not an actual block time + int64_t nLastRetargetTime = 1269205629; // NOTE: Not an actual block time CBlockIndex pindexLast; pindexLast.nHeight = 46367; pindexLast.nTime = 1269211443; // Block #46367 of Bitcoin // This represents an average difficulty in the current algorithm pindexLast.nBits = 0x1c387f6f; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c418995); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c4a93bb); } BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)