mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 05:49:11 +01:00
fix for DGW till perm fix later
This commit is contained in:
parent
9c25fc1034
commit
54fd5f3234
42
src/main.cpp
42
src/main.cpp
@ -2369,19 +2369,37 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp)
|
||||
pindexPrev = (*mi).second;
|
||||
nHeight = pindexPrev->nHeight+1;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Check proof of work
|
||||
if(nHeight >= 34140){
|
||||
unsigned int nBitsNext = GetNextWorkRequired(pindexPrev, this);
|
||||
double n1 = ConvertBitsToDouble(nBits);
|
||||
double n2 = ConvertBitsToDouble(nBitsNext);
|
||||
|
||||
// Check proof of work
|
||||
if(nHeight >= 34140 && nHeight <= 45000){
|
||||
unsigned int nBitsNext = GetNextWorkRequired(pindexPrev, this);
|
||||
double n1 = ConvertBitsToDouble(nBits);
|
||||
double n2 = ConvertBitsToDouble(nBitsNext);
|
||||
if (abs(n1-n2) > n1*0.2)
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork)"));
|
||||
} else {
|
||||
if (nBits != GetNextWorkRequired(pindexPrev, this))
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
|
||||
}
|
||||
|
||||
if (nHeight <= 45000) {
|
||||
if (abs(n1-n2) > n1*0.2)
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork)"));
|
||||
} else {
|
||||
if (abs(n1-n2) > n1*0.005)
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW2)"));
|
||||
}
|
||||
} else {
|
||||
if (nBits != GetNextWorkRequired(pindexPrev, this))
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
|
||||
}
|
||||
#else
|
||||
// Check proof of work
|
||||
if(nHeight >= 34140 && nHeight <= 45000){
|
||||
unsigned int nBitsNext = GetNextWorkRequired(pindexPrev, this);
|
||||
double n1 = ConvertBitsToDouble(nBits);
|
||||
double n2 = ConvertBitsToDouble(nBitsNext);
|
||||
if (abs(n1-n2) > n1*0.2)
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork)"));
|
||||
} else {
|
||||
if (nBits != GetNextWorkRequired(pindexPrev, this))
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Prevent blocks from too far in the future
|
||||
if(fTestNet || nHeight >= 45000){
|
||||
|
Loading…
Reference in New Issue
Block a user