Skip to content

Commit

Permalink
validation: Disable PermittedDifficultyTransition check
Browse files Browse the repository at this point in the history
  • Loading branch information
tecnovert committed Mar 11, 2024
1 parent cbbd179 commit f11c57e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct Params {
* This prevents us from warning about the CSV and segwit activations. */
int MinBIP9WarningHeight;

bool m_particl_mode = true;
/** Time at which OP_ISCOINSTAKE becomes active */
int64_t OpIsCoinstakeTime;
bool fAllowOpIsCoinstakeWithP2PKH;
Expand Down
2 changes: 1 addition & 1 deletion src/headerssync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ constexpr size_t REDOWNLOAD_BUFFER_SIZE{14441}; // 14441/606 = ~23.8 commitments

// Our memory analysis assumes 48 bytes for a CompressedHeader (so we should
// re-calculate parameters if we compress further)
static_assert(sizeof(CompressedHeader) == 48);
static_assert(sizeof(CompressedHeader) == 48 + 32);

HeadersSyncState::HeadersSyncState(NodeId id, const Consensus::Params& consensus_params,
const CBlockIndex* chain_start, const arith_uint256& minimum_required_work) :
Expand Down
4 changes: 4 additions & 0 deletions src/headerssync.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ struct CompressedHeader {
// header
int32_t nVersion{0};
uint256 hashMerkleRoot;
uint256 hashWitnessMerkleRoot;
uint32_t nTime{0};
uint32_t nBits{0};
uint32_t nNonce{0};

CompressedHeader()
{
hashMerkleRoot.SetNull();
hashWitnessMerkleRoot.SetNull();
}

CompressedHeader(const CBlockHeader& header)
{
nVersion = header.nVersion;
hashMerkleRoot = header.hashMerkleRoot;
hashWitnessMerkleRoot = header.hashWitnessMerkleRoot;
nTime = header.nTime;
nBits = header.nBits;
nNonce = header.nNonce;
Expand All @@ -45,6 +48,7 @@ struct CompressedHeader {
ret.nVersion = nVersion;
ret.hashPrevBlock = hash_prev_block;
ret.hashMerkleRoot = hashMerkleRoot;
ret.hashWitnessMerkleRoot = hashWitnessMerkleRoot;
ret.nTime = nTime;
ret.nBits = nBits;
ret.nNonce = nNonce;
Expand Down
1 change: 1 addition & 0 deletions src/kernel/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits

void CChainParams::SetOld()
{
consensus.m_particl_mode = false;
if (GetChainType() == ChainType::MAIN) {
consensus.script_flag_exceptions.clear();
consensus.script_flag_exceptions.emplace( // BIP16 exception
Expand Down
1 change: 1 addition & 0 deletions src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
bool PermittedDifficultyTransition(const Consensus::Params& params, int64_t height, uint32_t old_nbits, uint32_t new_nbits)
{
if (params.fPowAllowMinDifficultyBlocks) return true;
if (params.m_particl_mode) return true;

if (height % params.DifficultyAdjustmentInterval() == 0) {
int64_t smallest_timespan = params.nPowTargetTimespan/4;
Expand Down

0 comments on commit f11c57e

Please sign in to comment.