Skip to content
Permalink
Browse files

Deactivate ACP with higher hashrates above a specific height

  • Loading branch information...
Stouse49 committed Sep 12, 2018
1 parent 5446411 commit 7a76ae6933c7e5d96d3b0ce1d66a6133076dde00
Showing with 13 additions and 8 deletions.
  1. +3 −3 src/chainparams.cpp
  2. +9 −5 src/checkpointsync.cpp
  3. +1 −0 src/consensus/params.h
@@ -193,7 +193,7 @@ class CMainParams : public CChainParams {
0.06 // * estimated number of transactions per second after that timestamp
};
consensus.checkpointPubKey = "03fa3202fcecbb8efb084d92655e6300bef04753de0831439b74e88c6e52777ef5";

consensus.syncCheckpointHeight = 890000;
}
};
static CMainParams mainParams;
@@ -293,7 +293,7 @@ class CTestNetParams : public CChainParams {
0
};
consensus.checkpointPubKey = "0383485a411c6b9a259af83d732a759dcab948931c74e55458f9489c411d0a62b0";

consensus.syncCheckpointHeight = 40000;

}
};
@@ -385,7 +385,7 @@ class CRegTestParams : public CChainParams {
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
consensus.checkpointPubKey = "0383485a411c6b9a259af83d732a759dcab948931c74e55458f9489c411d0a62b0";

consensus.syncCheckpointHeight = 100;
}

void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
@@ -178,11 +178,15 @@ bool CheckSyncCheckpoint(const uint256& hashBlock, const CBlockIndex* pindexPrev
{
int nHeight = pindexPrev->nHeight + 1;

UniValue hashrate = GetNetworkHashPS(120, pindexPrev->nHeight);
int64_t now = GetAdjustedTime();
double toggleHashrate = 1e12 * pow(2, 2.0f*(now - 1536541807)/(365*24*60*60));
if(hashrate.get_real() > toggleHashrate)
return true;
// If the height is greater than syncChechpointHeight, then disregard
// synced checkpoints if the hashrate is high enough.
if(nHeight > Params().GetConsensus().syncCheckpointHeight) {
UniValue hashrate = GetNetworkHashPS(120, pindexPrev->nHeight);
int64_t now = GetAdjustedTime();
double toggleHashrate = 1e12 * pow(2, 2.0f*(now - 1536541807)/(365*24*60*60));
if(hashrate.get_real() > toggleHashrate)
return true;
}

LOCK(cs_hashSyncCheckpoint);
// Reset checkpoint to Genesis block if not found or initialised
@@ -94,6 +94,7 @@ struct Params {
int nRejectBlockOutdatedMajority;
int nToCheckBlockUpgradeMajority;
std::string checkpointPubKey;
int syncCheckpointHeight;
};
} // namespace Consensus

0 comments on commit 7a76ae6

Please sign in to comment.
You can’t perform that action at this time.