daa fork height
This commit is contained in:
@@ -5033,20 +5033,21 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
|||||||
|
|
||||||
assert(pindexPrev);
|
assert(pindexPrev);
|
||||||
|
|
||||||
int nHeight = pindexPrev->GetHeight()+1;
|
int daaForkHeight = GetArg("-daaforkheight", 448450);
|
||||||
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
int nHeight = pindexPrev->GetHeight()+1;
|
||||||
|
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||||
// Check Proof-of-Work difficulty
|
// Check Proof-of-Work difficulty
|
||||||
if (ishush3) {
|
if (ishush3) {
|
||||||
// The change of blocktime from 150s to 75s caused Weird Stuff in the difficulty/work calculations
|
// The change of blocktime from 150s to 75s caused Weird Stuff in the difficulty/work calculations
|
||||||
// caused by the fact that Difficulty Adjustment Algorithms do not take into account blocktime
|
// caused by the fact that Difficulty Adjustment Algorithms do not take into account blocktime
|
||||||
// changing at run-time, which breaks assumptions in the algorithm
|
// changing at run-time, which breaks assumptions in the algorithm
|
||||||
unsigned int nNextWork = GetNextWorkRequired(pindexPrev, &block, consensusParams);
|
unsigned int nNextWork = GetNextWorkRequired(pindexPrev, &block, consensusParams);
|
||||||
//if ((nHeight < 340000 || nHeight > 342500) && block.nBits != nNextWork) {
|
//if ((nHeight < daaheight) && block.nBits != nNextWork) {
|
||||||
if (block.nBits != nNextWork) {
|
if (block.nBits != nNextWork) {
|
||||||
//cout << "Incorrect HUSH diffbits at height " << nHeight <<
|
//cout << "Incorrect HUSH diffbits at height " << nHeight <<
|
||||||
// " " << block.nBits << " block.nBits vs. calc " << nNextWork <<
|
// " " << block.nBits << " block.nBits vs. calc " << nNextWork <<
|
||||||
// " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl;
|
// " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl;
|
||||||
if (nHeight < 340000) {
|
if (nHeight < daaForkHeight) {
|
||||||
return state.DoS(100, error("%s: Incorrect diffbits at height %d", __func__, nHeight), REJECT_INVALID, "bad-diffbits");
|
return state.DoS(100, error("%s: Incorrect diffbits at height %d", __func__, nHeight), REJECT_INVALID, "bad-diffbits");
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("%s: Ignoring nbits calc : %lu vs block %lu\n",__func__, nNextWork, block.nBits );
|
LogPrintf("%s: Ignoring nbits calc : %lu vs block %lu\n",__func__, nNextWork, block.nBits );
|
||||||
|
|||||||
11
src/pow.cpp
11
src/pow.cpp
@@ -508,13 +508,10 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||||||
// Changing this requires changing many other things and
|
// Changing this requires changing many other things and
|
||||||
// changes consensus. Have fun -- Duke
|
// changes consensus. Have fun -- Duke
|
||||||
int64_t AveragingWindowTimespan(int32_t height) {
|
int64_t AveragingWindowTimespan(int32_t height) {
|
||||||
int64_t AWT = 2550;
|
// used in const methods, beware!
|
||||||
/*
|
// This is the correct AWT for 75s blocktime, before block 340k
|
||||||
int32_t forkHeight = 0;
|
// the correct value was 2550 when the blocktime was 150s
|
||||||
if (height >= forkHeight) {
|
int64_t AWT = 1275;
|
||||||
AWT = 1275;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return AWT;
|
return AWT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user