|
|
@ -207,8 +207,9 @@ u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const |
|
|
|
if (!m_number) |
|
|
|
throw GenesisBlockCannotBeCalculated(); |
|
|
|
u256 o = max<u256>(c_minimumDifficulty, m_timestamp >= _parent.m_timestamp + c_durationLimit ? _parent.m_difficulty - (_parent.m_difficulty / c_difficultyBoundDivisor) : (_parent.m_difficulty + (_parent.m_difficulty / c_difficultyBoundDivisor))); |
|
|
|
if (unsigned periodCount = unsigned(_parent.number() + 1) / c_expDiffPeriod) |
|
|
|
o = (u256)max<bigint>(c_minimumDifficulty, bigint(o) - (bigint(1) << (periodCount - 1))); // latter will eventually become negative, so ensure it's a bigint.
|
|
|
|
unsigned periodCount = unsigned(_parent.number() + 1) / c_expDiffPeriod; |
|
|
|
if (periodCount > 2) |
|
|
|
o = (u256)max<bigint>(c_minimumDifficulty, bigint(o) - (bigint(1) << (periodCount - 2))); // latter will eventually become negative, so ensure it's a bigint.
|
|
|
|
return o; |
|
|
|
} |
|
|
|
|
|
|
|