|
|
@ -228,7 +228,7 @@ u256 BlockInfo::selectGasLimit(BlockInfo const& _parent) const |
|
|
|
return c_genesisGasLimit; |
|
|
|
else |
|
|
|
// target minimum of 3141592
|
|
|
|
return max<u256>(max<u256>(c_minGasLimit, 3141592), (_parent.gasLimit * (c_gasLimitBoundDivisor - 1) + (_parent.gasUsed * 6 / 5)) / c_gasLimitBoundDivisor); |
|
|
|
return max<u256>(max<u256>(c_minGasLimit, 3141592), _parent.gasLimit - _parent.gasLimit / c_gasLimitBoundDivisor + 1 + (_parent.gasUsed * 6 / 5) / c_gasLimitBoundDivisor); |
|
|
|
} |
|
|
|
|
|
|
|
u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const |
|
|
@ -246,9 +246,9 @@ void BlockInfo::verifyParent(BlockInfo const& _parent) const |
|
|
|
BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError((bigint)calculateDifficulty(_parent), (bigint)difficulty)); |
|
|
|
|
|
|
|
if (gasLimit < c_minGasLimit || |
|
|
|
gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor || |
|
|
|
gasLimit > _parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor) |
|
|
|
BOOST_THROW_EXCEPTION(InvalidGasLimit() << errinfo_min((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor) << errinfo_got((bigint)gasLimit) << errinfo_max((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor)); |
|
|
|
gasLimit <= _parent.gasLimit - _parent.gasLimit / c_gasLimitBoundDivisor || |
|
|
|
gasLimit >= _parent.gasLimit + _parent.gasLimit / c_gasLimitBoundDivisor) |
|
|
|
BOOST_THROW_EXCEPTION(InvalidGasLimit() << errinfo_min((bigint)_parent.gasLimit - _parent.gasLimit / c_gasLimitBoundDivisor) << errinfo_got((bigint)gasLimit) << errinfo_max((bigint)_parent.gasLimit + _parent.gasLimit / c_gasLimitBoundDivisor)); |
|
|
|
|
|
|
|
// Check timestamp is after previous timestamp.
|
|
|
|
if (parentHash) |
|
|
|