Browse Source

- becomes +

cl-refactor
Gav Wood 10 years ago
parent
commit
a0c84e1aaa
  1. 2
      libethcore/BlockInfo.cpp

2
libethcore/BlockInfo.cpp

@ -209,7 +209,7 @@ u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const
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)));
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.
o = max<u256>(c_minimumDifficulty, o + (u256(1) << (periodCount - 2))); // latter will eventually become huge, so ensure it's a bigint.
return o;
}

Loading…
Cancel
Save