Skip to content

Commit

Permalink
Fix headers not syncing due to permitted difficulty
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Nov 26, 2022
1 parent cd30acb commit 9a4b302
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <primitives/block.h>
#include <uint256.h>

/*!!!GRS GetNextWorkRequired is in groestlcoin.cpp defined
// GRS GetNextWorkRequired is in groestlcoin.cpp defined
/*
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
assert(pindexLast != nullptr);
Expand Down Expand Up @@ -77,6 +78,8 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
// or decrease beyond the permitted limits.
bool PermittedDifficultyTransition(const Consensus::Params& params, int64_t height, uint32_t old_nbits, uint32_t new_nbits)
{
// GRS uses DGW v3 for difficulty retarget
/*
if (params.fPowAllowMinDifficultyBlocks) return true;
if (height % params.DifficultyAdjustmentInterval() == 0) {
Expand Down Expand Up @@ -120,7 +123,7 @@ bool PermittedDifficultyTransition(const Consensus::Params& params, int64_t heig
if (minimum_new_target > observed_new_target) return false;
} else if (old_nbits != new_nbits) {
return false;
}
} */
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions src/test/validation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ BOOST_FIXTURE_TEST_SUITE(validation_tests, TestingSetup)

static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams)
{
/*!!!// GRS
// GRS
/*
int maxHalvings = 64;
CAmount nInitialSubsidy = 50 * COIN;
Expand All @@ -36,7 +37,8 @@ static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams)

static void TestBlockSubsidyHalvings(int nSubsidyHalvingInterval)
{
/*!!!// GRS
// GRS
/*
Consensus::Params consensusParams;
consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval;
TestBlockSubsidyHalvings(consensusParams);
Expand Down
3 changes: 2 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,8 @@ PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxM
return result;
}

/*!!!GRS
// GRS GetBlockSubsidy is in groestlcoin.cpp defined
/*
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
Expand Down

0 comments on commit 9a4b302

Please sign in to comment.